Re: Updatable cursors thoughts

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org, "FAST PostgreSQL" <fastpgs(at)fast(dot)fujitsu(dot)com(dot)au>
Subject: Re: Updatable cursors thoughts
Date: 2007-06-11 01:13:12
Message-ID: 20263.1181524392@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Simon Riggs" <simon(at)2ndquadrant(dot)com> writes:
> Sounds good. The cost is paid by the WHERE CURRENT OF query, not as an
> overhead on all cursors. Sounds like it will still be very fast too.

Yeah, there's zero added cost in the existing code paths, and the lookup
isn't really that expensive.

> Presumably still disallowing the WITH HOLD case.

Right --- once you've committed, you can't be sure the rows are still
there to look at.

I just finished revising the patch and am about to commit it. In the
event, my idea of a separate lookup function didn't work so well --- it
needed to be STABLE to be used in a tidscan qual, but it also needed to
be VOLATILE to prevent the planner from speculatively executing it
(resulting in premature failure if the cursor wasn't there at plan
time). So I ended up letting the special CurrentOfExpr node type
persist all the way through to execution. This required very minor
hackery in tidpath.c and nodeTidscan.c to accept such a node as a TID
qual; it would've taken something uglier to make the function
representation work.

One area that could still do with more work is getting the facility to
play nicely with views. However, it's probably premature to think about
that before we have updatable views that work well...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-06-11 01:21:05 What's with the StartDb:2 failures on skylark?
Previous Message Stephen Frost 2007-06-11 00:59:16 Re: Truncate Permission