Re: ORDER BY TABLENAME, possible bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Pantelis Theodosiou <ypercube(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, dv <udv(dot)mail(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: ORDER BY TABLENAME, possible bug
Date: 2016-11-18 23:33:30
Message-ID: 9267.1479512010@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Fri, Nov 18, 2016 at 3:35 PM, Pantelis Theodosiou <ypercube(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Kellerer 2016-11-18 23:37:58 Re: ORDER BY TABLENAME, possible bug
Previous Message David G. Johnston 2016-11-18 22:48:42 Re: ORDER BY TABLENAME, possible bug