[Sqlalchemy-tickets] Issue #4037: Glitch in the custom DDL documentation (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
From: Lele G. <iss...@bi...> - 2017-07-31 11:22:06
|
New issue 4037: Glitch in the custom DDL documentation https://bitbucket.org/zzzeek/sqlalchemy/issues/4037/glitch-in-the-custom-ddl-documentation Lele Gaifax: 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](https://www.postgresql.org/docs/9.6/static/sql-createtrigger.html) 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'); ``` |