Glitch in the custom DDL documentation / postgresql trigger correction

Issue #4037 new
Lele Gaifax created an issue

In the trigger definition near line 62 of doc/build/core/ddl.rst (sorry, could not find the proper syntax to hyperlink that line), where it is explicitly showing an example for PostgreSQL, the DDL uses a syntax which is not valid for a PG trigger:

CREATE TRIGGER dt_ins BEFORE INSERT ON mytable
FOR EACH ROW BEGIN SET NEW.data='ins'; END

Accordingly to the documentation a trigger cannot execute an arbitrary code block, but must run a procedure, so for example it could be written as:

CREATE TRIGGER dt_ins BEFORE INSERT ON mytable
FOR EACH ROW EXECUTE PROCEDURE set_data_field('ins');

Comments (3)

  1. Mike Bayer repo owner

    oh, well it seems triggers aren't running for postgresql in the tests either since we have to figure out this syntax.

    we need this one in the test suite to work in particular:

    CREATE TRIGGER dt_ins BEFORE INSERT ON dt "
                       "FOR EACH ROW BEGIN "
                       "SET NEW.col2='ins'; SET NEW.col4='ins'; END
    
  2. Log in to comment