Re: quote_literal with NULL

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: quote_literal with NULL
Date: 2007-10-10 09:19:30
Message-ID: 1192007970.4233.167.camel@ebony.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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 cases, since the
WHERE clause "col = NULL" does not do the same thing as "col is NULL".
So you need to know about NULL values and how to handle them in many
cases.

It might be useful to define a new text concatenation operator ||| that
treats NULL values as zero-length strings, so that
'help ' ||| NULL ||| 'me' returns 'help me'

--
Simon Riggs
2ndQuadrant http://www.2ndQuadrant.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2007-10-10 09:39:55 Re: Skytools committed without hackers discussion/review
Previous Message Michael Paesold 2007-10-10 09:04:34 Re: First steps with 8.3 and autovacuum launcher

Browse pgsql-patches by date

  From Date Subject
Next Message Brendan Jurd 2007-10-10 09:57:51 Re: quote_literal with NULL
Previous Message Peter Eisentraut 2007-10-10 07:07:55 Re: Provide a way to not ask for a password in psql