Re: Make subquery alias optional in FROM clause

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bernd Helmle <mailings(at)oopsware(dot)de>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Make subquery alias optional in FROM clause
Date: 2017-02-22 15:17:20
Message-ID: CAKFQuwZdSZOzVJGFd_iY7F_3Lx8Yk5r3Cy2G-F4vkiF4gs4PJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 22, 2017 at 8:08 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2017-02-22 15:18:12 Re: mat views stats
Previous Message Jim Nasby 2017-02-22 15:14:56 Re: Change in "policy" on dump ordering?