Re: Supporting multiple column assignment in UPDATE (9.5 project)

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting multiple column assignment in UPDATE (9.5 project)
Date: 2014-05-02 20:10:19
Message-ID: CAHyXU0xcsuh91jNv5-QDJbunZL6BtB+UoTXbRLkYFEVsYD24bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 2, 2014 at 3:03 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
>> On Fri, May 2, 2014 at 2:47 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> But I don't think your suggestions of the table name or alias work;
>>> they could conflict with an actual column name.
>
>> Presumably it'd follow similar rules to SELECT -- resolve the column
>> name in the face of ambiguity.
>
> Meh. Then you could have a query that works fine until you add a column
> to the table, and it stops working. If nobody ever used column names
> identical to table names it'd be all right, but unfortunately people
> seem to do that a lot...

That's already the case with select statements and, if a user were
concerned about that, always have the option of aliasing the table as
nearly 100% of professional developers do:

SELECT f FROM foo f;
etc.

Now, I need this feature a lot less than I used to (although I do like
the symmetry with SELECT); hstore and jsonb have matured to the point
that they can handle most trigger function operations that you'd want
to abstract over multiple tables without expensive calls to
information_schema. The main advantages for a native approach would
be type safety (although even that situation is improving at long
last), performance, and code complexity.

merlin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2014-05-02 23:34:28 regexp_replace( , , , NULL ) returns null?
Previous Message Tom Lane 2014-05-02 20:03:36 Re: Supporting multiple column assignment in UPDATE (9.5 project)