pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gemeinschaft Studienarbeit Datenbanken <oodbms@floppy.org>
Cc: pgsql-sql@hub.org
Subject: Re: Another nut to crack with insertion into tables... *sigh*
Date: Mon, 28 Sep 1998 10:02:10 -0400
Message-ID: <20074.906991330@sss.pgh.pa.us> (raw)
In-Reply-To: <199809280300.XAA18545@hub.org>

I dunno about arrays, but this one I think I can answer:

> insert into Rollenspiel
>         (Name, HerstellerID, Erscheinungsdatum,
>          Bestellnummer, Preisempfehlung,
>          Beschreibung,
>          Computertyp, Datentraegertyp,
>          System, AnzahlCharaktere, Typ,
>          Cluebook, SpielstandEditor)
>         values
>         ('Might & Magic I', (select HerstellerNummer from Hersteller
> 				where Name like '%Blueborg%'), '17.03.1986',
>          'role01', '29,50',
>          '{"Einfach irgendeine Beschreibung halt..."}',
>          '{"PC", "Mac", "c64", "Atari"}', '{"Diskette", "CD"}',
>          'Freies System', 6, 'Fantasy',
>          '{"Solution to Might & Magic Series", "The Might & Magic I Solution"}',
>          '{"http://www.mightandmagic.de/I/editors.html";}');
> ERROR:  parser: parse error at or near "select"

I believe sub-selects are currently only supported in WHERE clauses.
Supporting them elsewhere is on the TODO list for a future release
(no, 6.4 won't have it).  In the meantime you'll have to read back
the result of the sub-select and include it in the text of the INSERT.

(I'm not sure whether the SQL spec allows a select in an INSERT like this
anyway.  What happens if the sub-select returns no tuples, or more than
one tuple?)

			regards, tom lane



view thread (4+ messages)  latest in thread

Message-ID: <20074.906991330@sss.pgh.pa.us>
Permalink:  ../20074.906991330@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20074.906991330@sss.pgh.pa.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, oodbms@floppy.org, pgsql-sql@hub.org
  Subject: Re: Another nut to crack with insertion into tables... *sigh*
  In-Reply-To: <20074.906991330@sss.pgh.pa.us>
  References: <199809280300.XAA18545@hub.org> <20074.906991330@sss.pgh.pa.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