[ 
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: 10.7.1.1
>            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

Reply via email to