Re: Strange CREATE VIEW behavior??

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: evseenko(at)msiu(dot)ru, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Strange CREATE VIEW behavior??
Date: 2001-06-14 06:21:46
Message-ID: Pine.BSF.4.21.0106132320130.62540-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, 14 Jun 2001 pgsql-bugs(at)postgresql(dot)org wrote:

> Basil A. Evseenko (evseenko(at)msiu(dot)ru) reports a bug with a severity of 3
> The lower the number the more severe it is.
>
> Short Description
> Strange CREATE VIEW behavior??
>
> Long Description
> createdb test
> psql test
>
> test=# create table zz(ss int, ff varchar);
> test=# create view ff2 as select ff as user, ss as num from zz;
> test=# create view ff3 as select ff as user1, ss as num from zz;
> test=# \d ff2
> View "ff2"
> Attribute | Type | Modifier
> -----------+-------------------+----------
> user | character varying |
> num | integer |
> View definition: SELECT zz.ff AS "user", zz.ss AS num FROM zz;
>
> test=# \d ff3
> View "ff3"
> Attribute | Type | Modifier
> -----------+-------------------+----------
> user1 | character varying |
> num | integer |
> View definition: SELECT zz.ff AS user1, zz.ss AS num FROM zz;
>
> Why in the first case column has name "user" (with '"') ?

Probably because user is sometimes reserved. For example:
create table foo(user int); -- fails
create table foo("user" int); -- succeeds

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-06-14 06:37:34 Re: Strange CREATE VIEW behavior??
Previous Message pgsql-bugs 2001-06-14 06:07:43 Segmentation fault in psql