pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: umi.tanuki@gmail.com
Cc: pgsql-bugs@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: BUG #6572: The example of SPI_execute is bogus
Date: Wed, 04 Apr 2012 11:00:41 -0400
Message-ID: <25939.1333551641@sss.pgh.pa.us> (raw)
In-Reply-To: <E1SFFEX-0006wr-AT@wrigleys.postgresql.org>
References: <E1SFFEX-0006wr-AT@wrigleys.postgresql.org>

umi.tanuki@gmail.com writes:
> http://www.postgresql.org/docs/9.1/static/spi-spi-execute.html

> ===
> SPI_execute("INSERT INTO foo SELECT * FROM bar", false, 5);
> will allow at most 5 rows to be inserted into the table.
> ===

> This seems not true unless I'm missing something.

Hmm ... that did work as described, until we broke it :-(.  This is an
oversight in the 9.0 changes that added separate ModifyTuple nodes to
plan trees.  ModifyTuple doesn't return after each updated row, unless
there's a RETURNING clause; which means that the current_tuple_count
check logic in ExecutePlan() no longer stops execution as intended.

Given the lack of complaints since 9.0, maybe we should not fix this
but just redefine the new behavior as being correct?  But it seems
mighty inconsistent that the tuple limit would apply if you have
RETURNING but not when you don't.  In any case, the ramifications
are wider than one example in the SPI docs.

Thoughts?

			regards, tom lane



view thread (20+ messages)  latest in thread

Message-ID: <25939.1333551641@sss.pgh.pa.us>
Permalink:  ../25939.1333551641@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25939.1333551641@sss.pgh.pa.us

 · 

reply

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, umi.tanuki@gmail.com, pgsql-hackers@postgresql.org
  Subject: Re: BUG #6572: The example of SPI_execute is bogus
  In-Reply-To: <25939.1333551641@sss.pgh.pa.us>
  References: <E1SFFEX-0006wr-AT@wrigleys.postgresql.org> <25939.1333551641@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