Re: [SQL] INSERT and SELECT - Mailing list pgsql-sql

From wieck@debis.com (Jan Wieck)
Subject Re: [SQL] INSERT and SELECT
Date
Msg-id m11wTMj-0003kGC@orion.SAPserv.Hamburg.dsh.de
Whole thread Raw
In response to Re: [SQL] INSERT and SELECT  (Eric BARROCA <eric@netsystems.fr>)
List pgsql-sql
>
> Stuart Rison <rison@biochemistry.ucl.ac.uk> writes:
> > INSERT INTO table VALUES SELECT oid, 'test' FROM membre WHERE
> > email=3D"toto@toto.com";
> I've tried it, but it doesn't work too ("paser error near or at select"),
> even if I replace " by '.

    Because  VALUES  and  SELECT  are  mutually exclusive at that
    point.

    Just do INSERT INTO table SELECT ...

    or INSERT INTO TABLE (attrib, ...) SELECT ...

    and the parser should be happy.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #

pgsql-sql by date:

Previous
From: "Ross J. Reedstrom"
Date:
Subject: Re: [SQL] INSERT and SELECT
Next
From: neko@kredit.sth.szif.hu
Date:
Subject: Re: [SQL] INSERT and SELECT