1. Connect to PostgreSQL 9.x and run the following DDL statements.
CREATE TABLE test_table ( id INTEGER NOT NULL, name VARCHAR(50) NOT NULL, updated_on TIMESTAMP ) go CREATE OR REPLACE FUNCTION log_test_changes() RETURNS TRIGGER AS $$ BEGIN IF NEW.name <> OLD.name THEN UPDATE test_table SET updated_on=now() WHERE id=OLD.id; END IF; RETURN NEW; END; $$ LANGUAGE plpgsql go CREATE TRIGGER test_name_changes BEFORE UPDATE OF name ON test_table FOR EACH ROW EXECUTE PROCEDURE log_test_changes() go
2. Go to the Triggers node in the schema browser.
3. Select "test_name_changes" and bring up the pop-up menu.
Trigger Properties displays the following:
CREATE TRIGGER test_name_changes BEFORE UPDATE ON public.test_table FOR EACH ROW EXECUTE PROCEDURE log_test_changes()
CREATE TRIGGER "test_name_changes" BEFORE UPDATE ON public.test_table FOR EACH ROW EXECUTE PROCEDURE log_test_changes() GO
In both cases, the "UPDATE" clause is missing the column: UPDATE OF name
![]() |
702 B
|
64 KB
There are two problems in this issue.
1. Script Object -> CREATE didn't script columns in UPDATE OF clause.
This has already been implemented in v19. I've backported the changes that are specific to the UPDATE OF clause to v18.
2. Trigger Properties didn't script columns in UPDATE OF clause.
This is not working in v18 and v19. I've fixed this in both.
QA regression testing:
- The only changes made for this issue are to support UPDATE OF. None of the other v19 changes have been backported.
- Verify with different event types INSERT, UPDATE, and DELETE.
- For UPDATE, verify with UPDATE and UPDATE OF <columns>.
Verified in ADS v18.0.12-7 for PostgreSQL 9.1 and above
Verified in ADS v18.0.12-7 for PostgreSQL 9.1 and above
The following scenario doesn't work correctly. There are two triggers with the same name but on different tables and different columns for the UPDATE OF clause.
CREATE TABLE test_table ( id INTEGER NOT NULL, name VARCHAR(50) NOT NULL, updated_on TIMESTAMP ) go CREATE OR REPLACE FUNCTION log_test_changes() RETURNS TRIGGER AS $$ BEGIN IF NEW.name <> OLD.name THEN UPDATE test_table SET updated_on=now() WHERE id=OLD.id; END IF; RETURN NEW; END; $$ LANGUAGE plpgsql go CREATE TRIGGER test_name_changes BEFORE UPDATE OF name ON test_table FOR EACH ROW EXECUTE PROCEDURE log_test_changes() go CREATE TABLE test_table1 ( id1 INTEGER NOT NULL, name1 VARCHAR(50) NOT NULL, updated_on1 TIMESTAMP ) go CREATE OR REPLACE FUNCTION log_test_changes1() RETURNS TRIGGER AS $$ BEGIN IF NEW.name <> OLD.name THEN UPDATE test_table1 SET updated_on1=now() WHERE id1=OLD.id1; END IF; RETURN NEW; END; $$ LANGUAGE plpgsql go CREATE TRIGGER test_name_changes BEFORE UPDATE OF name1 ON test_table1 FOR EACH ROW EXECUTE PROCEDURE log_test_changes1() go
Select trigger "test_name_changes" on table "test_table". Script Object -> CREATE produces the following:
CREATE TRIGGER "test_name_changes" BEFORE UPDATE OF "name", "name1" ON "public"."test_table" FOR EACH ROW EXECUTE PROCEDURE log_test_changes() GO
The following scenario doesn't work correctly. There are two triggers with the same name but on different tables and different columns for the UPDATE OF clause.
CREATE TABLE test_table ( id INTEGER NOT NULL, name VARCHAR(50) NOT NULL, updated_on TIMESTAMP ) go CREATE OR REPLACE FUNCTION log_test_changes() RETURNS TRIGGER AS $$ BEGIN IF NEW.name <> OLD.name THEN UPDATE test_table SET updated_on=now() WHERE id=OLD.id; END IF; RETURN NEW; END; $$ LANGUAGE plpgsql go CREATE TRIGGER test_name_changes BEFORE UPDATE OF name ON test_table FOR EACH ROW EXECUTE PROCEDURE log_test_changes() go CREATE TABLE test_table1 ( id1 INTEGER NOT NULL, name1 VARCHAR(50) NOT NULL, updated_on1 TIMESTAMP ) go CREATE OR REPLACE FUNCTION log_test_changes1() RETURNS TRIGGER AS $$ BEGIN IF NEW.name <> OLD.name THEN UPDATE test_table1 SET updated_on1=now() WHERE id1=OLD.id1; END IF; RETURN NEW; END; $$ LANGUAGE plpgsql go CREATE TRIGGER test_name_changes BEFORE UPDATE OF name1 ON test_table1 FOR EACH ROW EXECUTE PROCEDURE log_test_changes1() go
Select trigger "test_name_changes" on table "test_table". Script Object -> CREATE produces the following:
CREATE TRIGGER "test_name_changes" BEFORE UPDATE OF "name", "name1" ON "public"."test_table" FOR EACH ROW EXECUTE PROCEDURE log_test_changes() GO
Fixed in both v18 and v19.
Please verify the scenarios mentioned in the issue description and this comment, and also triggers with no UPDATE OF <columns> clause and with UPDATE OF <columns> specifying multiple columns.
Fixed in both v18 and v19.
Please verify the scenarios mentioned in the issue description and this comment, and also triggers with no UPDATE OF <columns> clause and with UPDATE OF <columns> specifying multiple columns.
Verified both scenarios in ADS v18.0.13-1 and 19.0.0-alpha-21
Verified both scenarios in ADS v18.0.13-1 and 19.0.0-alpha-21
Issue #15259 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build ADS 18.0.13-1, 19.0.0-alpha-16 |
No time estimate |
There are two problems in this issue.
1. Script Object -> CREATE didn't script columns in UPDATE OF clause.
This has already been implemented in v19. I've backported the changes that are specific to the UPDATE OF clause to v18.
2. Trigger Properties didn't script columns in UPDATE OF clause.
This is not working in v18 and v19. I've fixed this in both.
QA regression testing:
- The only changes made for this issue are to support UPDATE OF. None of the other v19 changes have been backported.
- Verify with different event types INSERT, UPDATE, and DELETE.
- For UPDATE, verify with UPDATE and UPDATE OF <columns>.