Re: Making the subquery alias optional in the FROM clause - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Making the subquery alias optional in the FROM clause
Date
Msg-id CAKFQuwZ2BhzALU3iNzf9NOGyj00e5-dT1SAnyBW2uFCLyrBRFQ@mail.gmail.com
Whole thread Raw
In response to Re: Making the subquery alias optional in the FROM clause  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: Making the subquery alias optional in the FROM clause  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-hackers
On Mon, Jun 27, 2022 at 11:25 AM Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
On Mon, 27 Jun 2022 at 16:12, Julien Rouhaud <rjuju123@gmail.com> wrote:
>
> It doesn't play that well if you have something called subquery though:
>
> [example that changes a user-provided alias]
>
> While the output is a valid query, it's not nice that it's replacing a
> user provided alias with another one (or force an alias if you have a
> relation called subquery).

It's already the case that user-provided aliases can get replaced by
new ones in the query-deparsing code, e.g.:


Regardless, is there any reason to not just prefix our made-up aliases with "pg_" to make it perfectly clear they were generated by the system and are basically implementation details as opposed to something that appeared in the originally written query?

I suppose, "because we've haven't until now, so why start" suffices...but still doing a rename/suffixing because of query rewriting and inventing one where we made it optional seem different enough to justify implementing something different.

David J.

pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: Making the subquery alias optional in the FROM clause
Next
From: Dean Rasheed
Date:
Subject: Re: Making the subquery alias optional in the FROM clause