[ 
https://issues.apache.org/jira/browse/DERBY-6383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13808098#comment-13808098
 ] 

Knut Anders Hatlen commented on DERBY-6383:
-------------------------------------------

Thanks for looking at this bug, Mamta. The suggested fix looks reasonable to 
me. You might also want to change a comment further up in that method, which 
implies that only row-level triggers can be defined on specific columns:
{quote}
                        //This is the most interesting case for us. If we are 
here, 
                        //then it means that the trigger is defined at the row 
level
                        //and a set of trigger columns are specified in the 
CREATE
                        //TRIGGER statement. This can only happen for an UPDATE
                        //trigger.
{quote}

I stepped through the code in a debugger and found that the code was executed 
for statement-level triggers too, so the part that says that "the trigger is 
defined at the row level" is not correct.

> Update trigger defined on one column fires on update of other columns
> ---------------------------------------------------------------------
>
>                 Key: DERBY-6383
>                 URL: https://issues.apache.org/jira/browse/DERBY-6383
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.7.1.4, 10.8.1.2, 10.9.1.0, 10.10.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Mamta A. Satoor
>         Attachments: d6383.sql, DERBY6383_patch1_diff.txt
>
>
> I see this problem on 10.8 and higher. To reproduce, create a database with a 
> trigger like this:
> connect 'jdbc:derby:trigdb;create=true';
> create table t1(x int, y int);
> create table t2(x int, y int);
> create trigger tr after update of x on t1 referencing old table as old insert 
> into t2 select * from old;
> Then run dblook on the database, and you'll see the following output:
> -- ----------------------------------------------
> -- DDL Statements for triggers
> -- ----------------------------------------------
> CREATE TRIGGER "APP"."TR" AFTER UPDATE OF "X", "Y" ON "APP"."T1" REFERENCING 
> OLD_TABLE AS OLD FOR EACH STATEMENT insert into t2 select * from old;
> Notice that the DDL creates an update trigger for columns X and Y, whereas 
> the original trigger was defined on column X only.
> I see the expected DDL on 10.7.1.1.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to