Re: Proposition for autoname columns - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Proposition for autoname columns
Date
Msg-id CAKFQuwYdn4_oszcpmKxB5rH-CXqgMSsG9Q3Gx0c-EnmBgYjaBQ@mail.gmail.com
Whole thread Raw
In response to Re: Proposition for autoname columns  (Eugen Konkov <kes-kes@yandex.ru>)
List pgsql-hackers
On Thu, Nov 12, 2020 at 7:18 AM Eugen Konkov <kes-kes@yandex.ru> wrote:
Hello Andrew,

Thursday, November 12, 2020, 3:19:39 PM, you wrote:


> On 11/11/20 7:55 PM, Bruce Momjian wrote:

>   select j->>x from mytable;
> What should the column be named?

Suppose it should be named 'as x'

+1


> I think we'd be trying to manage a set of corner cases, and all because
> someone didn't want to put "as foo" in their query. And if we generate a
> column name in some cases and not in others there will be complaints of
> inconsistency.


Yes, this is suggesting a behavior that is contrary to (but not prohibited by) the natural expression and expectations of SQL.  That said, we already take a function's name and use it to specify the name of it output column as opposed to using "?column?" and requiring a user to apply a specific alias.  This is only a step beyond that, choosing the default name for an operator's output column based upon not the name of the operator (or its underlying function) but based upon its one (and only possible) right-hand argument.  It is purely a user convenience feature and can be rejected on that grounds but I'm not seeing any fundamental issue with only having some operator combinations doing this. It's nice when it works and you are no worse off than today when it doesn't.

David J.

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] xlog min recovery request ... is past current point ...
Next
From: Stephen Frost
Date:
Subject: Re: Add docs stub for recovery.conf