Re: [HACKERS] Make subquery alias optional in FROM clause - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: [HACKERS] Make subquery alias optional in FROM clause
Date
Msg-id CAKFQuwZdSZOzVJGFd_iY7F_3Lx8Yk5r3Cy2G-F4vkiF4gs4PJg@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Make subquery alias optional in FROM clause  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Feb 22, 2017 at 8:08 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Or else not generate
a name at all, in which case there simply wouldn't be a way to refer to
the subquery by name; I'm not sure what that might break though.

​Yeah, usually when I want this I don't end up needing refer by name:

First I write:

SELECT * <with aliasing and stuff>
FROM <some complexity here​>

The decide I need to do some result filtering

SELECT * FROM (
<original query>
) --ooops, forgot the alias
WHERE ...

Its for interactive use - and in fact I don't think I'd want to leave my production queries without names.

David J.

pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: [HACKERS] Change in "policy" on dump ordering?
Next
From: Jim Nasby
Date:
Subject: Re: [HACKERS] mat views stats