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-1773) insertRow() and updateRow() fail with syntax error when column has an alias
Date Thu, 18 Feb 2010 11:29:27 GMT

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

Knut Anders Hatlen commented on DERBY-1773:

My understanding is that "FOR UPDATE OF C1,C2" means that the cursor should be updatable,
but you can only update the columns C1 and C2 using that cursor. If there's an alias on C1
or C2, the statement should fail. Aliases on other columns than C1 and C2 should be allowed,
and the cursor should still be updatable if they are aliased. If I read the patch correctly,
it will make the cursor read only as long as there is at least one column that's aliased.
I don't think it's a big usability issue if we choose to disallow aliases altogether on updatable
cursors, but that would require changes to the reference manual [1] and probably also warrant
a release note, so I'd prefer not to impose that restriction.

I agree that the two different ways of aliasing (C2 AS A2 vs T1 AS A(A1,A2)) are equivalent
with regard to this issue and should be handled the same way.

I also agree that FOR UPDATE with no column list, or an implicit FOR UPDATE clause (DERBY-231),
means that all columns are updatable. Perhaps the alternative, more dynamic semantics are
more convenient in some cases, but we already have syntax for making just a subset of the
columns updatable, so I don't think it adds much value.

[1] http://db.apache.org/derby/docs/dev/ref/rrefsqlj41360.html#rrefsqlj41360__sqlj15384

> insertRow() and updateRow() fail with syntax error when column has an alias
> ---------------------------------------------------------------------------
>                 Key: DERBY-1773
>                 URL: https://issues.apache.org/jira/browse/DERBY-1773
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>            Priority: Minor
>         Attachments: Alias.java, NoUpdatesToAliasedColumnsWithTest.diff
> When the select query used in an updatable result set has column aliases, a syntax error
is thrown when executing ResultSet.insertRow() and ResultSet.updateRow(). The problem is seen
on embedded and client. Repro is attached.
> Exception in thread "main" ERROR 42X14: 'A1' is not a column in table or VTI 'APP.T'.
>         at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:316)
>         at org.apache.derby.impl.sql.compile.ResultColumn.bindResultColumnByName(ResultColumn.java:677)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.bindResultColumnsByName(ResultColumnList.java:682)
>         at org.apache.derby.impl.sql.compile.ResultSetNode.bindResultColumns(ResultSetNode.java:683)
>         at org.apache.derby.impl.sql.compile.SelectNode.bindResultColumns(SelectNode.java:742)
>         at org.apache.derby.impl.sql.compile.UpdateNode.bind(UpdateNode.java:349)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:345)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:111)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:723)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.updateRow(EmbedResultSet.java:3734)
>         at Alias.main(Alias.java:15)

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message