Обсуждение: BUG #5360: system column named "text"

Поиск
Список
Период
Сортировка

BUG #5360: system column named "text"

От
"Sergey Manakov"
Дата:
The following bug has been logged online:

Bug reference:      5360
Logged by:          Sergey Manakov
Email address:      vialorn@gmail.com
PostgreSQL version: 8.4.2
Operating system:   Fedora Core 8
Description:        system column named "text"
Details:

Hi! I'am from Russia and write English ugly, but i'am must to try...

I have some table with column named "remark" and without column named
"text". I wrote SQL where try to select column named "text" by mistake:

SELECT st.text
FROM sometable st

Where error expected, but query executed without error! Query result is one
column contains text representation of ROWs.

Is this a bug, or I'am look for description in docs badly?

Re: BUG #5360: system column named "text"

От
Tom Lane
Дата:
"Sergey Manakov" <vialorn@gmail.com> writes:
> I have some table with column named "remark" and without column named
> "text". I wrote SQL where try to select column named "text" by mistake:

> SELECT st.text
> FROM sometable st

> Where error expected, but query executed without error! Query result is one
> column contains text representation of ROWs.

> Is this a bug, or I'am look for description in docs badly?

No, it's not a bug.  It's equivalent to text(st) or st::text, that
is the system thinks you're requesting a coercion of the rowtype
value to text.  The syntactic equivalence of f(foo) and foo.f is
documented near the end of section 34.4.2:
http://www.postgresql.org/docs/8.4/static/xfunc-sql.html#AEN43797

            regards, tom lane