Skip site navigation (1) Skip section navigation (2)

Re: Subqueries in Non-SELECT Queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Frank Joerdens <frank(at)joerdens(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Subqueries in Non-SELECT Queries
Date: 2000-12-17 18:43:28
Message-ID: 21194.977078608@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-sql
Frank Joerdens <frank(at)joerdens(dot)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

In response to

pgsql-sql by date

Next:From: Mathijs BrandsDate: 2000-12-17 20:51:18
Subject: PostgreSQL crashes on me :(
Previous:From: Christof GlaserDate: 2000-12-17 18:32:50
Subject: Re: Subqueries in Non-SELECT Queries

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group