Re: ORDER BY TABLENAME, possible bug - Mailing list pgsql-bugs

From Tom Lane
Subject Re: ORDER BY TABLENAME, possible bug
Date
Msg-id 9267.1479512010@sss.pgh.pa.us
Whole thread Raw
In response to Re: ORDER BY TABLENAME, possible bug  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Fri, Nov 18, 2016 at 3:35 PM, Pantelis Theodosiou <ypercube@gmail.com>
> wrote:
>> Is this somewhere in the documentation?

> ​https://www.postgresql.org/docs/9.6/static/rowtypes.html
> ​"Whenever you create a table, a composite type is also automatically
> created, with the same name as the table, to represent the table's row
> type."

> So, its documented and in technically correct location.  I'm not sure if
> introducing this material in a "tutorial" would be a gain or just confuse
> the student.  It seems to be something one picks up somehow (trial and
> error, mailing list, stumbling upon it in the docs or elsewhere on the
> Internet) as one increases their knowledge of SQL to an intermediate level.

There's a whole bunch of behaviors around composite values that are
documented in scattered places, some of which are completely not where
you'd expect to look.  In this example, the fact that you can use a table
name/alias to represent the composite value of the current row is
something that isn't exactly obvious, much less how that relates to other
possible spellings such as "TABLENAME.*".  We had a related question just
a couple weeks ago, which caused me to wonder (not for the first time)
whether we could pull together some sort of unified presentation.
I haven't done anything about it though.

            regards, tom lane

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: ORDER BY TABLENAME, possible bug
Next
From: Thomas Kellerer
Date:
Subject: Re: ORDER BY TABLENAME, possible bug