Re: BUG #14405: ORDER BY TABLENAME, possible bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Francisco Olarte <folarte(at)peoplecall(dot)com>
Cc: udv(dot)mail(at)gmail(dot)com, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14405: ORDER BY TABLENAME, possible bug
Date: 2016-10-29 15:34:39
Message-ID: 27822.1477755279@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Francisco Olarte <folarte(at)peoplecall(dot)com> writes:
> Then, I do not remember whether that's a bug or a feature, and have
> not been able to see it in the docs, do not even know how to do it (
> tried some places without luck ), so someone more knowledgeable can
> point us in the right direction.

Yeah: really, "tablename" is a whole-row variable, and "tablename.colname"
is an application of a field-selection operation to a composite value,
but you're not required to perform such a selection after mentioning
a whole-row variable, if it's in a context where the system can do
something sensible with a composite value. Another way to say it is
that "tablename" and "tablename.*" are interchangeable notations for
a composite value representing the table's current row, everywhere except
at the top level of a SELECT list, where the standard mandates that "*"
references be burst into individual column references.

I had thought this was documented someplace, but after trawling our SGML
docs the closest thing I can find is the discussion in
https://www.postgresql.org/docs/current/static/sql-expressions.html#FIELD-SELECTION
and that's not terribly explicit. There's also some related material in
https://www.postgresql.org/docs/current/static/rowtypes.html
but that doesn't seem to state this straight out either.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Will Pearson 2016-10-31 10:47:14 Re: BUG #14403: Large numbers of CREATE OR UPDATE function causes memory exhaustion
Previous Message Francisco Olarte 2016-10-29 14:54:23 Re: BUG #14405: ORDER BY TABLENAME, possible bug