Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3950

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.5.1.1
    • 10.5.1.1
    • SQL
    • None
    • Patch Available

    Description

      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;

      Attachments

        1. derby-3950-01-aa-forbidOverrides.diff
          10 kB
          Richard N. Hillegas

        Issue Links

          Activity

            People

              rhillegas Richard N. Hillegas
              rhillegas Richard N. Hillegas
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: