diff options
Diffstat (limited to 'contrib/spi/autoinc.example')
-rw-r--r-- | contrib/spi/autoinc.example | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/spi/autoinc.example b/contrib/spi/autoinc.example index a2f470dc2d..08880ce5fa 100644 --- a/contrib/spi/autoinc.example +++ b/contrib/spi/autoinc.example @@ -8,9 +8,9 @@ CREATE TABLE ids ( idesc text ); -CREATE TRIGGER ids_nextid +CREATE TRIGGER ids_nextid BEFORE INSERT OR UPDATE ON ids - FOR EACH ROW + FOR EACH ROW EXECUTE PROCEDURE autoinc (id, next_id); INSERT INTO ids VALUES (0, 'first (-2 ?)'); @@ -19,11 +19,11 @@ INSERT INTO ids(idesc) VALUES ('third (1 ?!)'); SELECT * FROM ids; -UPDATE ids SET id = null, idesc = 'first: -2 --> 2' +UPDATE ids SET id = null, idesc = 'first: -2 --> 2' WHERE idesc = 'first (-2 ?)'; -UPDATE ids SET id = 0, idesc = 'second: -1 --> 3' +UPDATE ids SET id = 0, idesc = 'second: -1 --> 3' WHERE id = -1; -UPDATE ids SET id = 4, idesc = 'third: 1 --> 4' +UPDATE ids SET id = 4, idesc = 'third: 1 --> 4' WHERE id = 1; SELECT * FROM ids; |