You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2016/03/13 00:20:33 UTC

[jira] [Commented] (DERBY-1773) insertRow() and updateRow() fail with syntax error when column has an alias

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

ASF subversion and git services commented on DERBY-1773:
--------------------------------------------------------

Commit 1734744 from [~bryanpendleton] in branch 'code/trunk'
[ https://svn.apache.org/r1734744 ]

DERBY-1773: cursor updates fail with syntax error when column has an alias

This change enhances the runtime column analysis code so that an updatable
cursor can make a more nuanced decision about whether a column update is
or is not allowed.

Specifically, certain columns may not be updated, if they have been aliased.

Prior to this change, a confusing syntax error message would be delivered
when attempting to update an aliased column. Now, a more clear error message
is delivered, pointing at the fact that the aliased column is not in the
FOR UPDATE list of the cursor.

So the net result is (at least, should be) that the same set of queries are
accepted, but those that are not accepted have a slightly more clear message
issued when they are detected.

> 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: 10.2.1.6
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>            Priority: Minor
>              Labels: derby_triage10_5_2
>         Attachments: ASF.LICENSE.NOT.GRANTED--Alias.java, NoUpdatesToAliasedColumnsWithTest.diff, anyVsAll.diff, fixedComments.diff, updatedToHeadMarch2010.diff, updatedToHeadMarch2016.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 was sent by Atlassian JIRA
(v6.3.4#6332)