pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-bugs@postgresql.org
Subject: Re: ORDER BY TABLENAME, possible bug
Date: Sat, 19 Nov 2016 00:37:58 +0100
Message-ID: <o0o3ch$k0v$1@blaine.gmane.org> (raw)
In-Reply-To: <CAKFQuwYxpywGJgdvtsVrRXTgCDd5xNYe9abCyfv3EFJNuKXOjg@mail.gmail.com>
References: <CAGwx4BnDQZyJJpzom-UU15wh7s3DQE=ChEdEDQ2+rd5S7S2UNA@mail.gmail.com>
	<CAFj8pRCkPrb=OfOa6A63WpLJExXkKDg1GKfJ4bPs8088bcBAFA@mail.gmail.com>
	<CAE3TBxwNsfrHJc=XaTpZ3aq6=Z4PevcqQgQOi3wAh7mNB8pioA@mail.gmail.com>
	<CAKFQuwYxpywGJgdvtsVrRXTgCDd5xNYe9abCyfv3EFJNuKXOjg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

David G. Johnston schrieb am 18.11.2016 um 23:48:
>
> Is this somewhere in the documentation? The only place I could find
> where there is a hint of this use, is the Note in Row Constructors in
> https://www.postgresql.org/docs/current/static/sql-expressions.html
> <https://www.postgresql.org/docs/current/static/sql-expressions.html;
> that uses a table alias without the .* in an expression: ROW(t, 42)
>
> ​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.

I think the chapter about "Select Lists"[1] would be the approriate place to explain this.

I would also love to see an explanation there on why "select (a,b,c)" is something different then "select a,b,c"

I see far too many people putting the columns of the select list between parentheses and then being confused about the output.

I don't know if the Postgres behaviour is mandated by the SQL standard.

If it's not, that should be documented, maybe in the chapter I mentioned above or in the compatibility section of SELECT.
If that _is_ mandated by the standard, then I think some small note/warning might be useful (especially to newcomers)

Thomas



[1] https://www.postgresql.org/docs/current/static/queries-select-lists.html



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (6+ messages)

Message-ID: <o0o3ch$k0v$1@blaine.gmane.org>
Permalink:  ../o0o3ch$k0v$1@blaine.gmane.org/
Also on:    postgresql.org/message-id/o0o3ch$k0v$1@blaine.gmane.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: ORDER BY TABLENAME, possible bug
  In-Reply-To: <o0o3ch$k0v$1@blaine.gmane.org>
  References: <CAGwx4BnDQZyJJpzom-UU15wh7s3DQE=ChEdEDQ2+rd5S7S2UNA@mail.gmail.com> <CAFj8pRCkPrb=OfOa6A63WpLJExXkKDg1GKfJ4bPs8088bcBAFA@mail.gmail.com> <CAE3TBxwNsfrHJc=XaTpZ3aq6=Z4PevcqQgQOi3wAh7mNB8pioA@mail.gmail.com> <CAKFQuwYxpywGJgdvtsVrRXTgCDd5xNYe9abCyfv3EFJNuKXOjg@mail.gmail.com> <o0o3ch$k0v$1@blaine.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox