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-5157) Incomplete quoting of SQL identifiers in AlterTableConstantAction
Date Tue, 29 Mar 2011 08:01:06 GMT

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

Knut Anders Hatlen commented on DERBY-5157:

Thanks for looking at the patch, Dag. I see a lock timeout in the second test case as well
if I back out the fix. But if I only back out the fix in getColumnMax(), so that the first
test case passes, the second one fails with the expected syntax error, so I think it does
its job. I'm a bit puzzled by the timeout exception, though. The transaction should be rolled
back by BaseJDBCTestCase.tearDown() and release the locks, but for some reason rollback()
fails with "ERROR X0Y67: Cannot issue rollback in a nested connection when there is a pending
operation in the parent connection." This isn't a problem introduced by the fix, so I'll go
ahead committing the patch. I'll do some more digging and file a separate issue for the rollback
problem if it looks like there is a bug.

> Incomplete quoting of SQL identifiers in AlterTableConstantAction
> -----------------------------------------------------------------
>                 Key: DERBY-5157
>                 URL: https://issues.apache.org/jira/browse/DERBY-5157
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: derby-5157-1a.diff
> AlterTableConstantAction generates SQL statements various places. Identifiers (schema
names, table names, column names) are surrounded with double quotes in case they contain special
characters. This is not enough if the identifiers contain double quotes, as can be seen with
this example:
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> alter table t add column """" int default 42;
> ERROR 42X01: Syntax error: Encountered "\"" at line 1, column 22.
> I've found three places where AlterTableConstantAction generates SQL statements: updateNewColumnToDefault(),
updateNewAutoincrementColumn(), getColumnMax(). All three places suffer from this problem.

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message