Subqueries in Non-SELECT Queries - Mailing list pgsql-sql

From Frank Joerdens
Subject Subqueries in Non-SELECT Queries
Date
Msg-id 3A3CFFF9.3615E576@joerdens.de
Whole thread Raw
Responses Re: Subqueries in Non-SELECT Queries
Re: Subqueries in Non-SELECT Queries
List pgsql-sql
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


pgsql-sql by date:

Previous
From: "Albert REINER"
Date:
Subject: Re: Documentation for CASE
Next
From: Christof Glaser
Date:
Subject: Re: Subqueries in Non-SELECT Queries