Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Patches > Re: plpgsql CAS...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 3677 of 4084
Post > Topic >>

Re: plpgsql CASE statement - last version

by tgl@[EMAIL PROTECTED] (Tom Lane) May 15, 2008 at 06:46 PM

"Pavel Stehule" <pavel.stehule@[EMAIL PROTECTED]
> writes:
> I am sending little bit smarter version - without redundant parsing.

Applied with corrections --- you had some memory management problems
in particular.

One thing that I think might annoy people is that you've handled

	CASE x
	    WHEN a, b, c THEN ...

by producing the equivalent of "IF x IN (a, b, c)".  This means that
all three of the a, b, c expressions will be evaluated even if "a"
matches.  The SQL spec doesn't appear to promise short-circuit
evaluation in such a case, but I suspect somebody out there might
have a problem someday.  It didn't seem tremendously easy to fix though.
I suppose anyone who does have a problem can rewrite as

	CASE x
	    WHEN a THEN ...
	    WHEN b THEN ...
	    WHEN c THEN ...

at the cost of duplicating their THEN code.

			regards, tom lane

-- 
Sent via pgsql-patches mailing list (pgsql-patches@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches
 




 2 Posts in Topic:
Re: plpgsql CASE statement - last version
pavel.stehule@[EMAIL PROT  2008-05-03 10:12:13 
Re: plpgsql CASE statement - last version
tgl@[EMAIL PROTECTED] (T  2008-05-15 18:46:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 6:27:08 CDT 2008.