db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6390) Document the WHEN clause in the CREATE TRIGGER statement
Date Fri, 25 Oct 2013 09:56:31 GMT

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

Knut Anders Hatlen commented on DERBY-6390:

The requirements for the searchCondition in a constraint are stricter than the requirements
for the searchCondition in a WHEN clause. Only the dynamic parameters restriction in that
list apply to the WHEN clause. (Note to self: We should add tests to verify that those restrictions
don't apply.)

Actually, I think the current placement of the searchCondition topic (under CONSTRAINT clause)
is suboptimal. It would be better to have it in the SQL expressions section, and link to it
from CONSTRAINT clause, WHERE clause, HAVING clause, CASE expression, and from the ON clause
specifications in the INNER JOIN and LEFT/RIGHT OUTER JOIN topics. The searchCondition topic
could again link to booleanExpression.

In the SQL standard, the production rule for searchCondition is as simple as {{<search
condition> ::= <boolean value expression>}}. So one possible short-cut we could take
(one which the topics for WHERE, ON and CASE already take) is to link the WHEN clause specification
directly to booleanExpression. (This still leaves the HAVING clause with a reference to searchCondition
even though it doesn't have the restrictions of the CONSTRAINT clause, so in that case we
might want to update the HAVING clause with a reference to booleanExpression too.)

Essentially, the searchCondition in the WHEN clause is the same as in the WHERE clause, except
that the restrictions already listed for the triggeredSQLStatement also apply to the WHEN

And by the way... Boolean expressions are defined two different places: [here|http://db.apache.org/derby/docs/10.10/ref/rrefsqlj19433.html]
in a paragraph of the top-level SQL expressions topic, and [here|http://db.apache.org/derby/docs/10.10/ref/rrefsqlj23075.html]
as an independent sub-topic of SQL expressions. The former links to the latter, but the latter
does not link to the former. The latter is what other topics typically link to. Unfortunately,
that topic does not mention that a boolean expression might also be a general expression that
returns a boolean value. It would be good to have that information in that topic too, so that
it doesn't give the impression that a boolean expression has to use one of the boolean operators
listed in the table.

> Document the WHEN clause in the CREATE TRIGGER statement
> --------------------------------------------------------
>                 Key: DERBY-6390
>                 URL: https://issues.apache.org/jira/browse/DERBY-6390
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
>            Assignee: Kim Haase
> The documentation should be updated with information about the WHEN clause that was added
to the CREATE TRIGGER statement in DERBY-534. The functional specification attached to that
issue has a list of topics that need updating.

This message was sent by Atlassian JIRA

View raw message