[ 
https://issues.apache.org/jira/browse/DERBY-534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-534:
-------------------------------------

    Attachment: derby-534-10-a-get-sps.diff

The old, incomplete code for the WHEN clause, which predated this issue, has 
diverged from the rest of the trigger implementation over time. In particular, 
I noticed that TriggerDescriptor.getActionSPS() contained fixes for DERBY-4874 
and an old bug from the Cloudscape bug tracker (4821), but none of those fixes 
were in TriggerDescriptor.getWhenClauseSPS().

The attached patch, derby-534-10-a-get-sps.diff, moves most of the code out of 
getActionSPS() and into a helper method called getSPS(). Both getActionSPS() 
and getWhenClauseSPS() now call that helper method, so that they behave 
similarly and the two aforementioned bugs are also fixed for the WHEN clause.

The patch adds two test cases to TriggerWhenClauseTest:

- testDerby4874() reproduces symptoms similar to DERBY-4874 by changing the 
data type of a column referenced from a WHEN clause. The test case fails with a 
truncation error without the fix.

- testCloudscapeBug4821() shows a problem with system table locks being held in 
the parent transaction after recompilation of a WHEN clause that had been 
invalidated. The test case fails with a lock timeout without the fix.

All the regression tests passed with the patch.

> Support use of the WHEN clause in CREATE TRIGGER statements
> -----------------------------------------------------------
>
>                 Key: DERBY-534
>                 URL: https://issues.apache.org/jira/browse/DERBY-534
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Kristian Waagan
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>              Labels: derby_triage10_11
>         Attachments: derby-534-01-a-syntax.diff, 
> derby-534-02-a-refactor.diff, derby-534-03-a-npe-testcase.diff, 
> derby-534-04-a-referencing.diff, derby-534-05-a-generated-cols.diff, 
> derby-534-06-a-temptables.diff, derby-534-07-a-more-restrictions.diff, 
> derby-534-08-a-test-invalidation.diff, derby-534-09-a-drop-column-deps.diff, 
> derby-534-09-b-drop-column-deps.diff, derby-534-10-a-get-sps.diff, 
> parser.diff, WhenClause.html, WhenClause.html, WhenClause.html, 
> WhenClause.html
>
>
> Support use of the WHEN clause in CREATE TRIGGER statements. The clause is 
> described in the SQL standard (2003) in chapter "11.39 <trigger definition>" 
> under "<triggered action>".
> There are traces in the code that suggests some work has been done on this 
> earlier. If anyone knows something about this, please add a comment to this 
> issue.



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

Reply via email to