Re: Odd unfamiliar Postgres SQL syntax

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sonny <sonny(dot)chee(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Odd unfamiliar Postgres SQL syntax
Date: 2017-07-31 19:03:17
Message-ID: 9468.1501527797@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Sonny <sonny(dot)chee(at)gmail(dot)com> writes:
> Can someone help me understand the following SQL? What does the notation
> (i.keys).n and (i.keys).x mean... as indicated by the <<<=== in the query.

"(i.keys).n" is selecting the column named "n" from the composite-valued
column "i.keys", where "i" is a table alias exposed by the FROM clause.
The reason we don't just write "i.keys.n" is that the SQL standard says
that should mean column "n" in a table "i.keys" exposed by the FROM
clause --- that is, "i" would be a schema name not a table alias, and
"keys" would be a table name not a column name.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Majid Khan 2017-08-01 12:01:36 PostgreSQL connection with Android Studio
Previous Message Pavel Stehule 2017-07-31 19:02:13 Re: Odd unfamiliar Postgres SQL syntax