Re: [HACKERS] quote_literal with NULL - Mailing list pgsql-patches

From Brendan Jurd
Subject Re: [HACKERS] quote_literal with NULL
Date
Msg-id 37ed240d0710141952n501e26acteb68ad9921fce26b@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] quote_literal with NULL  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: [HACKERS] quote_literal with NULL
List pgsql-patches
On 10/12/07, Simon Riggs <simon@2ndquadrant.com> wrote:
> I think you should add some examples to show how we would handle an
> INSERT or an UPDATE SET with quite_nullable() and a SELECT WHERE clause
> with quote_literal. The difference is a subtle one, which is why nobody
> mentioned it before, so it needs some better docs too.
>
> A cross-ref to the functions page would help also.

Alright, I've improved the documentation along the lines suggested by
Simon.  There's a full example on doing a null-safe dynamic UPDATE, as
well as a brief discussion about being wary of using comparison
operators with NULLs (e.g., in WHERE clauses).  Cross references
abound.

I did make a version of the patch which has the pg_proc entries for
quote_literal and quote_nullable both pointing to the same internal
function.  I thought this was a tidier solution, but it failed
regression test #5 in opr_sanity; apparently two entries in pg_proc
can't have the same prosrc and differing proisstrict?

Cheers,
BJ

Attachment

pgsql-patches by date:

Previous
From: "Brendan Jurd"
Date:
Subject: Re: [HACKERS] quote_literal with NULL
Next
From: Heikki Linnakangas
Date:
Subject: Re: Updated patch for tsearch contrib examples