> View definition: SELECT zz.ff AS "user", zz.ss AS num FROM zz;
> View definition: SELECT zz.ff AS user1, zz.ss AS num FROM zz;
> Why in the first case column has name "user" (with '"') ?
USER is a keyword. It happens not to be reserved, so you can use it for
an AS name without quoting it, but the view decompiler doesn't want to
take any chances so it quotes it anyway.
It would be correct and 100% safe for Postgres to display these rules
with all identifiers quoted:
View definition: SELECT "zz"."ff" AS "user1", "zz"."ss" AS "num" FROM "zz";
but since that's pretty unreadable, we try to suppress the quotes where
they're not essential. The decompiler just errs on the side of safety
when it sees that the identifier matches a keyword: rather than trying
to figure out if the keyword is reserved in this particular context,
it just adds the quotes always.
regards, tom lane
In response to
pgsql-bugs by date
|Next:||From: Tom Lane||Date: 2001-06-14 06:39:31|
|Subject: Re: Segmentation fault in psql |
|Previous:||From: Stephan Szabo||Date: 2001-06-14 06:21:46|
|Subject: Re: Strange CREATE VIEW behavior??|