extra syntax on INSERT - Mailing list pgsql-hackers

From Limin Liu
Subject extra syntax on INSERT
Date
Msg-id 3B16A86C.EC14A048@pumpkinnet.com
Whole thread Raw
Responses Re: extra syntax on INSERT  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I just realized that INSERT allows us to have more syntax than the
manual said.  I wonder if we want to elimiate it or keep it with more
documentation on the INSERT statment?

Here is the INSERT synopsis we have in 7.2 documentation.
==========
INSERT INTO table [ ( column [, ...] ) ]
    { DEFAULT VALUES | VALUES ( expression [, ...] ) | SELECT query }

Assume we have,
CREATE TABLE t1 (a1 int, a2 int);
CREATE TABLE t2 (a3 int, a4 int);

INSERT INTO t2 VALUES(2, 0);
INSERT INTO t2 VALUES(2,1);

====  postgres allows to have something like ====

INSERT INTO t1 VALUES(1, 0 AS "Oops");
INSRET INTO t1 VALUES(t2.*);

===================

For the first one, I believe that is due to reusing the definition of
target_list/target_el.  I didn't dig in to see how PostgreSQL handle the
second case.  At least the INSRET synopsis does not cover this case.


--
Regards,
LM Liu



pgsql-hackers by date:

Previous
From: Karel Zak
Date:
Subject: Re: Cache for query plans
Next
From: Peter Eisentraut
Date:
Subject: Re: Access statistics