From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | depstein(at)alliedtesting(dot)com, pgsql-bugs(at)postgresql(dot)org, pgagarinov(at)alliedtesting(dot)com, vshahov(at)alliedtesting(dot)com |
Subject: | Re: Can't use WITH in a PERFORM query in PL/pgSQL? |
Date: | 2011-10-19 12:36:26 |
Message-ID: | CA+TgmoazonH3XsKwCO1-MSpd+YnT48TpzcHjEJRJQDjkY1Y-AA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tue, Sep 6, 2011 at 1:43 PM, Bruce Momjian <bruce(at)momjian(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-10-19 12:41:26 | Re: BUG #5944: COPY FROM doesn't work with international characters |
Previous Message | Robert Haas | 2011-10-19 12:32:56 | Re: BUG #6215: ODBC - ovelflow with the OIDs - Large Objects |