From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jan Hink <hink@rac.cz>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Create into temp table as select doesn set "found"
Date: Thu, 18 Dec 2014 10:51:34 -0500
Message-ID: <16270.1418917894@sss.pgh.pa.us> (raw)
In-Reply-To: <OFD975D6E0.8C8E71DE-ONC1257DB2.003324AE-C1257DB2.00343CE0@rac.cz>
References: <OFD975D6E0.8C8E71DE-ONC1257DB2.003324AE-C1257DB2.00343CE0@rac.cz>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Jan Hink <hink@rac.cz> writes:
> In plpgsql procedure I have this commads:
> create temp table t_expert on commit drop as
> select * from v_expert e where user_account=$1;
> get diagnostics rowcount=row_count;
> raise notice 'found=%, rowcount=%', found, rowcount;
> The notice returned "found=f, rowcount=2"
> I expected "found" should be set properly to true, when rowcount>0.
The set of statements that affect FOUND is specified here:
http://www.postgresql.org/docs/9.3/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS
CREATE TABLE AS is not among them.
In a green field we might think that it would be a good idea if it did,
but at this point in plpgsql's evolution changing that behavior would
be more likely to break existing code than to make users happier.
In particular, there is intentionally not a promise that FOUND and
ROW_COUNT are set by the exact same collections of statements.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, hink@rac.cz
Subject: Re: Create into temp table as select doesn set "found"
In-Reply-To: <16270.1418917894@sss.pgh.pa.us>
References: <OFD975D6E0.8C8E71DE-ONC1257DB2.003324AE-C1257DB2.00343CE0@rac.cz> <16270.1418917894@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox