pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: SELECT INTO deprecation
Date: Tue, 15 Dec 2020 17:13:25 -0500
Message-ID: <20201215221325.GA14807@momjian.us> (raw)
In-Reply-To: <737048bf-de51-3fd4-bbcc-89f6d2bd2c4f@enterprisedb.com>
References: <96dc0df3-e13a-a85d-d045-d6e2c85218da@enterprisedb.com>
	<20201202175836.GX16415@tamriel.snowman.net>
	<1672926.1606941346@sss.pgh.pa.us>
	<X8gpP9GL7R5AsF3E@paquier.xyz>
	<8e05fc79-abca-dd3f-4d48-8aaae9525a8f@enterprisedb.com>
	<1723856.1607009655@sss.pgh.pa.us>
	<a71c0215-3ab1-abab-babe-2778b17aa1d7@enterprisedb.com>
	<737048bf-de51-3fd4-bbcc-89f6d2bd2c4f@enterprisedb.com>

On Wed, Dec  9, 2020 at 09:48:54PM +0100, Peter Eisentraut wrote:
> On 2020-12-03 20:26, Peter Eisentraut wrote:
> > On 2020-12-03 16:34, Tom Lane wrote:
> > > As I recall, a whole lot of the pain we have with INTO has to do
> > > with the semantics we've chosen for INTO in a set-operation nest.
> > > We think you can write something like
> > > 
> > >      SELECT ... INTO foo FROM ... UNION SELECT ... FROM ...
> > > 
> > > but we insist on the INTO being in the first component SELECT.
> > > I'd like to know exactly how much of that messiness is shared
> > > by SQL Server.
> > 
> > On sqlfiddle.com, this works:
> > 
> > select a into t3 from t1 union select a from t2;
> > 
> > but this gets an error:
> > 
> > select a from t1 union select a into t4 from t2;
> > 
> > SELECT INTO must be the first query in a statement containing a UNION,
> > INTERSECT or EXCEPT operator.
> 
> So, with that in mind, here is an alternative proposal that points out that
> SELECT INTO has some use for compatibility.

Do we really want to carry around confusing syntax for compatibility?  I
doubt we would ever add INTO now, even for compatibility.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee






view thread (18+ messages)  latest in thread

Message-ID: <20201215221325.GA14807@momjian.us>
Permalink:  ../20201215221325.GA14807@momjian.us/
Also on:    postgresql.org/message-id/20201215221325.GA14807@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: bruce@momjian.us, peter.eisentraut@enterprisedb.com, tgl@sss.pgh.pa.us, michael@paquier.xyz, sfrost@snowman.net
  Subject: Re: SELECT INTO deprecation
  In-Reply-To: <20201215221325.GA14807@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox