pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Joerdens <frank@joerdens.de>
To: pgsql-sql@postgresql.org
Subject: Subqueries in Non-SELECT Queries
Date: Sun, 17 Dec 2000 19:03:37 +0100
Message-ID: <3A3CFFF9.3615E576@joerdens.de> (raw)

I am trying to do something that looks to me exactly like what's described in chapter 8.4
in the Postgresql book:

test=> UPDATE salesorder
test-> SET ship_date = '11/16/96'
test-> WHERE customer_id = (
test(> SELECT customer_id
test(> FROM customer
test(> WHERE name = 'Fleer Gearworks, Inc.'
test(> );
UPDATE 1

Here only one row is updated. This should work with more than one, right? I get an error
which suggests that it doesn't:

mpi=# update index set level = 2 where parentid = ( select id from index where level = 1
);
ERROR:  More than one tuple returned by a subselect used as an expression.
mpi=#

This is a recursive query, on a single table. Is that not possible?

I am using 7.1.

- Frank



view thread (4+ messages)  latest in thread

Message-ID: <3A3CFFF9.3615E576@joerdens.de>
Permalink:  ../3A3CFFF9.3615E576@joerdens.de/
Also on:    postgresql.org/message-id/3A3CFFF9.3615E576@joerdens.de

 · 

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: frank@joerdens.de
  Subject: Re: Subqueries in Non-SELECT Queries
  In-Reply-To: <3A3CFFF9.3615E576@joerdens.de>
  References: <3A3CFFF9.3615E576@joerdens.de>

* 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