db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-1773) insertRow() and updateRow() fail with syntax error when column has an alias
Date Sat, 05 Mar 2016 21:08:40 GMT

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

Bryan Pendleton updated DERBY-1773:
    Attachment: anyVsAll.diff

Uhm, I guess I lost track of this issue, for it's been 6 years! :)

The first thing I did was to bring the previous patch up to date,
since a lot can change in 6 years. 'updatedToHeadMarch2016.diff'
is the result, and it builds and passes tests with the head of trunk.

Upon closely re-reading Knut Anders's comments from 6 years ago,
I remembered that I had not addressed his observation that it
would be possible for some, but not all, of the columns in the
result list to be aliased, and only those columns which are aliased
should be non-updatable; the unaliased columns should still be

After thinking about that for a while, it seemed to me that this
merely required changing the proposed ResultColumnList.columnsAreUpdatable()
method so that it tested whether *any* columns in the list were
updatable, as opposed to requiring that *all* columns in the
list were updatable.

So I did that, and added a few additional test cases, and the
results appear to be satisfactory.

The revised patch is attached as anyVsAll.diff.

I'm running tests on it now, to see how it behaves.

Sorry for the 6 year gap, but if anyone is still interested
in this issue, feedback would be gratefully received.

> 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
>              Labels: derby_triage10_5_2
>         Attachments: ASF.LICENSE.NOT.GRANTED--Alias.java, NoUpdatesToAliasedColumnsWithTest.diff,
anyVsAll.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

View raw message