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] Commented: (DERBY-4110) When deleting rows from a table name with its synonym name, Derby throws SQLSTATE 42X04.
Date Tue, 01 Dec 2009 14:53:20 GMT

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

Bryan Pendleton commented on DERBY-4110:

The patch below appears to make the repro script pass, and appears to cause
no other ill effects (in simple testing). The idea behind the patch is that when
building the ResultColumnList that is used to tie together the search results
from the WHERE clause with the processing of the DELETE, the result columns
will be bound against the exposed table name of the table named in the DELETE
statement, so if the statement used a synonymTableName, then the result
column list should manufacture column references which use a synonymTableName as well.

I'm not sure about the operation of the 'normalizeSynonymColumns' code that I
commented on last week; I don't understand exactly when that code comes into play,
but it does NOT appear to be relevant to this particular case. I think it has more to
do with the fact that INSERT and UPDATE can refer to a named set of columns which
are to be affected by the statement, whereas DELETE operates on the entire row.

Anyway, here's the patch I'm currently pursuing:

Index: java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java
--- java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java  (revision 885667)
+++ java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java  (working copy)
@@ -361,7 +361,7 @@
-                   targetTableName,
+                   synonymTableName != null ? synonymTableName : targetTableName,

> When deleting rows from a table name with its synonym name, Derby throws SQLSTATE 42X04.
> ----------------------------------------------------------------------------------------
>                 Key: DERBY-4110
>                 URL: https://issues.apache.org/jira/browse/DERBY-4110
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions:
>            Reporter: Lakshmi Prasanna
>            Assignee: Bryan Pendleton
>         Attachments: repro.sql
> Getting an error (using Derby when deleting records from a table using a qualified
synonymn name.
> Table Name is ABC_PROCESS_INVOCATION_XML and the synonmyn name is SYN_ABC_P_I_X
> The query being fired was
> "Delete from SYN_ABC_P_I_X where ID = ? "
> from the error log
> ---------------
> Caused by: ERROR 42X04: Column 'APP.ABC_PROCESS_INVOCATION_XML.ID' is either not in any
table in the FROM list or appears within a join specification and is outside the scope of
the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this
is a CREATE or ALTER TABLE  statement then 'APP.ABC_PROCESS_INVOCATION_XML.ID' is not a column
in the target table.
> ---------------
> After going thru few earlier bugs, a similar bug has been logged earlier bug DERBY-1784

> http://issues.apache.org/jira/browse/DERBY-1784
> But looks like the fix did not make its way to

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

View raw message