Re: INSERT ... SELECT nonpositional syntax

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matthew Mellon <matthew(dot)mellon(at)gmail(dot)com>
Cc: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: INSERT ... SELECT nonpositional syntax
Date: 2024-05-20 22:58:05
Message-ID: 3697380.1716245885@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Matthew Mellon <matthew(dot)mellon(at)gmail(dot)com> writes:
> SAP's products have a nice feature not found in the ANSI standards for the
> INSERT ... SELECT syntax: WITH AUTO NAME. Assume you have a table that
> looks something like this:
> ...
> INSERT INTO TableX
> WITH AUTO NAME
> SELECT a i,
> b j,
> c k
> FROM TableY;

> I'm not complaining here, but just wondering if there is a way that the
> syntax can be extended at this level using an extension, or if there is a
> fighting chance of extending the syntax in the base product?

I recall that we've discussed having some way to do this; but not with
that particular syntax. If memory serves, the last proposal looked
more like UPDATE ... SET, that is

INSERT INTO TableX SET i = a, j = b, k = c FROM TableY;

The general consensus though seems to be that we don't want to get
out front of the SQL standards committee on something like this.
If we do, for sure they'll standardize some other way to do
the same thing :-(

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Rita 2024-05-22 20:41:29 selecting a materialized view function, plpgsql
Previous Message Matthew Mellon 2024-05-20 21:56:47 INSERT ... SELECT nonpositional syntax