On Tue, Sep 6, 2011 at 1:43 PM, Bruce Momjian <br...@momjian.us> wrote: > Well, this problem isn't isolated to WITH queries: > > test=> do > $$begin > perform( > select 1 UNION ALL select 1 > ); > end$$; > ERROR: more than one row returned by a subquery used as an expression > > test=> do > $$begin > perform( > select relname from pg_class > ); > end$$; > ERROR: more than one row returned by a subquery used as an expression >
Based on previous experience with PL/pgsql, my understanding is that PL/pgsql basically replaces "perform" with "select" to get the query that it actually runs. You'd get the same error from: rhaas=# select (select relname from pg_class); ERROR: more than one row returned by a subquery used as an expression I've never really liked this behavior, but I don't have a clear idea what to do about it. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs