Re: Proposition for autoname columns

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Eugen Konkov <kes-kes(at)yandex(dot)ru>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposition for autoname columns
Date: 2020-11-12 15:05:28
Message-ID: CAKFQuwYdn4_oszcpmKxB5rH-CXqgMSsG9Q3Gx0c-EnmBgYjaBQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 12, 2020 at 7:18 AM Eugen Konkov <kes-kes(at)yandex(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2020-11-12 15:25:13 Re: Add docs stub for recovery.conf
Previous Message Robert Haas 2020-11-12 15:02:04 Re: [HACKERS] xlog min recovery request ... is past current point ...