pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedCreate into temp table as select doesn set "found"
2+ messages / 2 participants
[nested] [flat]
* Create into temp table as select doesn set "found"
@ 2014-12-18 09:30 Jan Hink <hink@rac.cz>
0 siblings, 1 reply; 2+ messages in thread
From: Jan Hink @ 2014-12-18 09:30 UTC (permalink / raw)
To: pgsql-bugs
Hello,
I found an unexpected behavior, I suppose it is a little bug.
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.
If not then I cannot use easy "if not found then ..." and I am forced to
write more rows in my code.
I wonder I have not found similar issue in any discussion yet.
With Regards
Jan Hink
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Create into temp table as select doesn set "found"
@ 2014-12-18 15:51 Tom Lane <tgl@sss.pgh.pa.us>
parent: Jan Hink <hink@rac.cz>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2014-12-18 15:51 UTC (permalink / raw)
To: Jan Hink <hink@rac.cz>; +Cc: pgsql-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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2014-12-18 15:51 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-12-18 09:30 Create into temp table as select doesn set "found" Jan Hink <hink@rac.cz>
2014-12-18 15:51 ` Tom Lane <tgl@sss.pgh.pa.us>
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