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 Sql > Re: Testing for...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 3403 of 3631
Post > Topic >>

Re: Testing for null record in plpgsql

by craig@[EMAIL PROTECTED] (Craig Ringer) Apr 11, 2008 at 03:40 PM

Erik Jones wrote:
> Now, let's say I want to call this from another function and test the 
> result to see if I have a null record (null, null),.  I've got the 
> following working but it feels like there should be something much 
> simpler but I just can't seem to hit on it.  Is this it?
I'm assuming that returns_null_maybe() is  a dummy to show general 
behavior. I can't imagine why you'd ever want to do what it's doing.

In general I'm suspicious of code that's testing for a real, known value 
and returning NULL in its place. It seems like an odd thing to do. 
Still, I'm sure you have your reasons and they probably make sense in 
the real application rather than the simplified example.

You can tidy test_null_rec a little by just using:

RETURN row(res.*) IS DISTINCT FROM row(null_rec.*);

but otherwise, without incor****ating it into the containing query as a 
subquery I don't see much to be done. I'm still curious about the 
purpose of using null values like this is, though.

--
Craig Ringer

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




 4 Posts in Topic:
Testing for null record in plpgsql
erik@[EMAIL PROTECTED] (  2008-04-10 23:16:40 
Re: Testing for null record in plpgsql
craig@[EMAIL PROTECTED]   2008-04-11 15:40:53 
Re: Testing for null record in plpgsql
erik@[EMAIL PROTECTED] (  2008-04-11 09:35:28 
Re: Testing for null record in plpgsql
pavel.stehule@[EMAIL PROT  2008-04-11 07:21:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Thu Aug 21 22:59:27 CDT 2008.