You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Rick Hillegas (JIRA)" <ji...@apache.org> on 2008/11/14 22:05:44 UTC

[jira] Created: (DERBY-3950) You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet

You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet
------------------------------------------------------------------------------------------------------------

                 Key: DERBY-3950
                 URL: https://issues.apache.org/jira/browse/DERBY-3950
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.5.0.0
            Reporter: Rick Hillegas


On DERBY-481 Dag points out the following bug:

drop table t1;
drop table t2;

create table t1( a int, b int generated always as ( -a ) );
create table t2( a int, b int );

insert into t2( a, b ) values ( 1, 100 );

-- should fail to compile. instead, it compiles but at run time the generation clause
-- overrides the value coming from the select
insert into t1 select * from t2;

-- should fail to compile. instead, it compiles but at run time the generation clause
-- overrides the value coming from the select
insert into t1 select a, 0 from t2;

-- should also fail to compile. instead, it compiles but at run time the generation clause
-- overrides the value coming from the list of literals
insert into t1 values( 2, 200 );

select * from t1;


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


[jira] Updated: (DERBY-3950) You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Myrna van Lunteren updated DERBY-3950:
--------------------------------------

    Fix Version/s: 10.5.0.0

> You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3950
>                 URL: https://issues.apache.org/jira/browse/DERBY-3950
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>             Fix For: 10.5.0.0
>
>         Attachments: derby-3950-01-aa-forbidOverrides.diff
>
>
> On DERBY-481 Dag points out the following bug:
> drop table t1;
> drop table t2;
> create table t1( a int, b int generated always as ( -a ) );
> create table t2( a int, b int );
> insert into t2( a, b ) values ( 1, 100 );
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select * from t2;
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select a, 0 from t2;
> -- should also fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the list of literals
> insert into t1 values( 2, 200 );
> select * from t1;

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


[jira] Resolved: (DERBY-3950) You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Hillegas resolved DERBY-3950.
----------------------------------

    Resolution: Fixed

> You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3950
>                 URL: https://issues.apache.org/jira/browse/DERBY-3950
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-3950-01-aa-forbidOverrides.diff
>
>
> On DERBY-481 Dag points out the following bug:
> drop table t1;
> drop table t2;
> create table t1( a int, b int generated always as ( -a ) );
> create table t2( a int, b int );
> insert into t2( a, b ) values ( 1, 100 );
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select * from t2;
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select a, 0 from t2;
> -- should also fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the list of literals
> insert into t1 values( 2, 200 );
> select * from t1;

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


[jira] Updated: (DERBY-3950) You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Hillegas updated DERBY-3950:
---------------------------------

    Derby Info: [Patch Available]

> You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3950
>                 URL: https://issues.apache.org/jira/browse/DERBY-3950
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-3950-01-aa-forbidOverrides.diff
>
>
> On DERBY-481 Dag points out the following bug:
> drop table t1;
> drop table t2;
> create table t1( a int, b int generated always as ( -a ) );
> create table t2( a int, b int );
> insert into t2( a, b ) values ( 1, 100 );
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select * from t2;
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select a, 0 from t2;
> -- should also fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the list of literals
> insert into t1 values( 2, 200 );
> select * from t1;

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


[jira] Updated: (DERBY-3950) You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Hillegas updated DERBY-3950:
---------------------------------

    Attachment: derby-3950-01-aa-forbidOverrides.diff

Attaching derby-3950-01-aa-forbidOverrides.diff. This prevents driving SELECTs and VALUEs lists from attempting to override generation clauses. Offending statements now fail at bind() time. Running tests now.

Generated clauses now behave like identity columns when you try to override their contents.

Touches the following files:

M      java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java

Adds a new piece of state to this node so that it can track whether a DEFAULT literal was inserted into a generated column.  This differs from the processing of identities. The different processing arises because generation clauses are bound later than other expressions.


M      java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java

Adds a paragraph to a method which checks to see whether the user is trying to override an identity column. Renames that method because it now performs a similar check for generated columns.


M      java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
M      java/engine/org/apache/derby/impl/sql/compile/InsertNode.java

Calls the above method by its new name.


M      java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
M      java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsHelper.java

Tests.


> You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3950
>                 URL: https://issues.apache.org/jira/browse/DERBY-3950
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.0.0
>            Reporter: Rick Hillegas
>         Attachments: derby-3950-01-aa-forbidOverrides.diff
>
>
> On DERBY-481 Dag points out the following bug:
> drop table t1;
> drop table t2;
> create table t1( a int, b int generated always as ( -a ) );
> create table t2( a int, b int );
> insert into t2( a, b ) values ( 1, 100 );
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select * from t2;
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select a, 0 from t2;
> -- should also fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the list of literals
> insert into t1 values( 2, 200 );
> select * from t1;

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


[jira] Assigned: (DERBY-3950) You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Hillegas reassigned DERBY-3950:
------------------------------------

    Assignee: Rick Hillegas

> You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3950
>                 URL: https://issues.apache.org/jira/browse/DERBY-3950
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-3950-01-aa-forbidOverrides.diff
>
>
> On DERBY-481 Dag points out the following bug:
> drop table t1;
> drop table t2;
> create table t1( a int, b int generated always as ( -a ) );
> create table t2( a int, b int );
> insert into t2( a, b ) values ( 1, 100 );
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select * from t2;
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select a, 0 from t2;
> -- should also fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the list of literals
> insert into t1 values( 2, 200 );
> select * from t1;

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


[jira] Closed: (DERBY-3950) You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Hillegas closed DERBY-3950.
--------------------------------


> You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3950
>                 URL: https://issues.apache.org/jira/browse/DERBY-3950
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>             Fix For: 10.5.1.1
>
>         Attachments: derby-3950-01-aa-forbidOverrides.diff
>
>
> On DERBY-481 Dag points out the following bug:
> drop table t1;
> drop table t2;
> create table t1( a int, b int generated always as ( -a ) );
> create table t2( a int, b int );
> insert into t2( a, b ) values ( 1, 100 );
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select * from t2;
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select a, 0 from t2;
> -- should also fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the list of literals
> insert into t1 values( 2, 200 );
> select * from t1;

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


[jira] Commented: (DERBY-3950) You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648336#action_12648336 ] 

Rick Hillegas commented on DERBY-3950:
--------------------------------------

Tests ran cleanly for me except for the heisenbug in org.apache.derbyTesting.functionTests.tests.multi.StressMultiTest. Committed derby-3950-01-aa-forbidOverrides.diff at subversion revision 718381.

> You should get an error if you try to override a generated column via an INSERT driven by an inner ResultSet
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3950
>                 URL: https://issues.apache.org/jira/browse/DERBY-3950
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-3950-01-aa-forbidOverrides.diff
>
>
> On DERBY-481 Dag points out the following bug:
> drop table t1;
> drop table t2;
> create table t1( a int, b int generated always as ( -a ) );
> create table t2( a int, b int );
> insert into t2( a, b ) values ( 1, 100 );
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select * from t2;
> -- should fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the select
> insert into t1 select a, 0 from t2;
> -- should also fail to compile. instead, it compiles but at run time the generation clause
> -- overrides the value coming from the list of literals
> insert into t1 values( 2, 200 );
> select * from t1;

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