Re: NEXT VALUE FOR <sequence>

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thomas Munro <munro(at)ip9(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NEXT VALUE FOR <sequence>
Date: 2014-10-05 01:07:55
Message-ID: 87zjdb8gvn.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

>>> The spec clearly says one value per row, not one per statement;
>>> so command ID is very definitely not the right thing.

>> I think (command ID, estate->es_processed) would work.

Tom> Not terribly well, eg each new transaction starts over at
Tom> command ID 1. You could fix that particular objection by also
Tom> tracking virtual xid. But the bigger issue is that using
Tom> es_processed for this seems like an utter hack. It's not meant
Tom> to be anything but statistical, and it's not maintained anyway
Tom> for non-canSetTag queries (ie, DO ALSO rule commands). That
Tom> reflects the fact that what it's meant to do is count the number
Tom> of rows returned to the executor's caller, which isn't
Tom> necessarily the definition we'd need here.

Maybe it would make sense to do something with a SubPlan, rather than
trying to hide everything inside a function?

--
Andrew (irc:RhodiumToad)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-10-05 01:12:24 Re: replicating DROP commands across servers
Previous Message Robert Haas 2014-10-05 01:03:17 Re: pg_receivexlog and replication slots