Re: [HACKERS] quote_literal with NULL

2007-10-11 Thread Brendan Jurd
On 10/11/07, Tom Lane <[EMAIL PROTECTED]> wrote: > Well, it's clearly useful in INSERT and UPDATE. For WHERE cases, you > might or might not be able to use it, but I note that quote_nullable() > would work much more like what happens if you use a parameter symbol > and then bind NULL as the actual

Re: [HACKERS] quote_literal with NULL

2007-10-10 Thread Tom Lane
"Greg Sabino Mullane" <[EMAIL PROTECTED]> writes: >> Perhaps have quote_nullable() then as well? >> >> You then use quote_nullable() in INSERT and UPDATE SET clauses and >> quote_literal() in SELECT WHERE clauses. > I still don't see the use case. Wouldn't your app still need to check > for nul

Re: [HACKERS] quote_literal with NULL

2007-10-10 Thread Michael Glaesemann
On Oct 10, 2007, at 11:24 , Greg Sabino Mullane wrote: (Aside: seems to me that SET foo = NULL; really should be SET foo TO NULL; to be consistent with WHERE foo IS NULL;) The = character has different meanings in these two cases. UPDATE foos SET foo = NULL -- assignment WHERE bar IS NULL -

Re: [HACKERS] quote_literal with NULL

2007-10-10 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > Perhaps have quote_nullable() then as well? > > You then use quote_nullable() in INSERT and UPDATE SET clauses and > quote_literal() in SELECT WHERE clauses. I still don't see the use case. Wouldn't your app still need to check for nullabil

Re: [HACKERS] quote_literal with NULL

2007-10-10 Thread Simon Riggs
On Wed, 2007-10-10 at 10:12 -0500, Kevin Grittner wrote: > >>> On Wed, Oct 10, 2007 at 4:57 AM, in message > <[EMAIL PROTECTED]>, "Brendan Jurd" > <[EMAIL PROTECTED]> wrote: > > On 10/10/07, Simon Riggs <[EMAIL PROTECTED]> wrote: > >> On Wed, 2007-10-10 at 14:57 +1000, Brendan Jurd wrote: > >> >

Re: [HACKERS] quote_literal with NULL

2007-10-10 Thread Kevin Grittner
>>> On Wed, Oct 10, 2007 at 4:57 AM, in message <[EMAIL PROTECTED]>, "Brendan Jurd" <[EMAIL PROTECTED]> wrote: > On 10/10/07, Simon Riggs <[EMAIL PROTECTED]> wrote: >> On Wed, 2007-10-10 at 14:57 +1000, Brendan Jurd wrote: >> >> > Wouldn't it be more useful if quote_literal(NULL) yielded the text

Re: [HACKERS] quote_literal with NULL

2007-10-10 Thread Brendan Jurd
On 10/10/07, Simon Riggs <[EMAIL PROTECTED]> wrote: > On Wed, 2007-10-10 at 14:57 +1000, Brendan Jurd wrote: > > > Wouldn't it be more useful if quote_literal(NULL) yielded the text value > > 'NULL'? > > I don't think you can change that now. There could be code out there > that relies on that beh

Re: [HACKERS] quote_literal with NULL

2007-10-10 Thread Simon Riggs
On Wed, 2007-10-10 at 14:57 +1000, Brendan Jurd wrote: > Wouldn't it be more useful if quote_literal(NULL) yielded the text value > 'NULL'? I don't think you can change that now. There could be code out there that relies on that behaviour. It isn't very helpful to return the word NULL in many c

[HACKERS] quote_literal with NULL

2007-10-09 Thread Brendan Jurd
Hi hackers, I note that if you pass NULL to quote_literal(), you get NULL. This isn't surprising, but I was thinking that the stated purpose of quote_literal is preparing the argument for entry into a dynamic SQL statement. In this context, it fails for NULL input. Wouldn't it be more useful if