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

Simple column names specified as part of "AS" clause in a table expression are ignored if the table expression is a view.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.1.4, 10.3.2.1
    • 10.5.3.1, 10.6.1.0
    • SQL
    • None
    • Normal
    • High Value Fix
    • Wrong query result

    Description

      Simple repro as follows:

      create table t1 (i int, j int);
      insert into t1 values (1, 1), (1, -1), (2, 2), (3, -3), (4, 4);

      create view v1 as select j, i from t1;
      create view v2 (x,y,z) as select j, i, i+j from t1;

      – OK: Returns column names specified in AS clause.
      select * from t1 as x(a,b);

      – OK: Returns column names for the views
      select * from v1;
      select * from v2;

      – WRONG: Ignores column names specified in AS clause for the views.
      select * from v1 x(a,b);
      select * from v2 as x(a,b,c);

      I observed this as far back as 10.0.2.1, so this is not a regression.

      Attachments

        1. derby-3478.stat
          0.2 kB
          Dag H. Wanvik
        2. derby-3478.diff
          5 kB
          Dag H. Wanvik

        Activity

          People

            dagw Dag H. Wanvik
            army A B
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: