Avi Kivity ([EMAIL PROTECTED]) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
Keyword USER not detected in CREATE VIEW

Long Description
The reserved keyword USER is rejected in CREATE TABLE, as expected:

  avi=> create table x (user varchar);
  ERROR:  parser: parse error at or near "user"

In my ignorance, however, I tried to create a view with a field named user:

  avi=> create table y (x varchar);
  CREATE
  avi=> create view z as select x as user from y;
  CREATE

Note no error.

  avi=> \d z
                   View "z"
   Attribute |       Type        | Modifier
  -----------+-------------------+----------
   user      | character varying |
  View definition: SELECT y.x AS "user" FROM y;

  avi=> insert into y values ('zz');
  INSERT 43771 1
  avi=> select user from z;
   current_user
  --------------
   avi
  (1 row)

Wrong value returned.

  avi=> select "user" from z;
   user
  ------
   zz
  (1 row)

Correct value returned.

My expected result: an error message in CREATE VIEW


Sample Code


No file was uploaded with this report


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to