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

Knut Anders Hatlen updated DERBY-5157:
--------------------------------------

    Attachment: derby-5157-1a.diff

The attached patch fixes the problems by using the helper methods in IdUtil and 
StringUtil to do the quoting properly. It also adds test cases to verify the 
fixes (except the one in updateNewAutoincrementColumn() since that code isn't 
currently in use).

> 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