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 Mon, 28 Mar 2011 12:44:05 GMT

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

Knut Anders Hatlen commented on DERBY-5157:
-------------------------------------------

I think the code in updateNewAutoincrementColumn() isn't currently in use because of DERBY-3888.

The bug in updateNewColumnToDefault() is shown by the ALTER TABLE statement in the bug description.

The problem in getColumnMax() can be exposed by executing these statements:

ij> create table t ("""" int generated always as identity);
0 rows inserted/updated/deleted
ij> alter table t alter column """" set increment by 2;
ERROR 42X01: Syntax error: Encountered "APP" at line 1, column 22.

> 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
>
> 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

Mime
View raw message