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

From Tom Lane
Subject Re: Subqueries in Non-SELECT Queries
Date
Msg-id 21194.977078608@sss.pgh.pa.us
Whole thread Raw
In response to Subqueries in Non-SELECT Queries  (Frank Joerdens <frank@joerdens.de>)
List pgsql-sql
Frank Joerdens <frank@joerdens.de> writes:
> 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.

Apparently the subquery "select id from index where level = 1" is
returning more than one row.  Perhaps you want WHERE parentid IN subselect
rather than WHERE parentid = subselect.  "=" is a scalar operator, not
a set operator.
        regards, tom lane


pgsql-sql by date:

Previous
From: Christof Glaser
Date:
Subject: Re: Subqueries in Non-SELECT Queries
Next
From: Mathijs Brands
Date:
Subject: PostgreSQL crashes on me :(