Re: Cannot dump/restore text value \N

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Manfred Koizar <mkoi-pg(at)aon(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Cannot dump/restore text value \N
Date: 2003-10-05 23:12:50
Message-ID: 15628.1065395570@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Manfred Koizar <mkoi-pg(at)aon(dot)at> writes:
> To be clear, this is not about \N as the default external
> representation for NULL, I'm talking about a string consisting of the
> two characters backslash and uppercase-N.

Now that I look at it, this must have been broken since the beginning of
time, or at least since we made the null representation configurable.
Surprising no one noticed before.

The problem is that the WITH NULL string is compared to the attribute
value *after* debackslashing, and so there is no way to prevent a match
to an actual valid data string.

In older code it seems that the representation of NULL as \N was
hardwired, and this was tested for in the process of debackslashing,
so that the valid data string \\N wouldn't be mistaken for \N.

For the purposes of recognizing the default \N null representation,
it seems we have to compare the null representation string to the
pre-debackslashing input. (This is probably fairly easy to make happen
in CVS tip, but it might be pretty painful in 7.3.) Arguably this is
the right semantics because in the other direction we don't backslash
the outgoing null-representation string. I wonder whether it would
break any existing apps though.

Comments?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-10-05 23:22:38 Re: [COMMITTERS] pgsql-server/src/backend/catalog aclchk.c
Previous Message Stephan Szabo 2003-10-05 22:52:34 Re: Open 7.4 items

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-10-05 23:39:59 Re: Open 7.4 items
Previous Message Stephan Szabo 2003-10-05 22:52:34 Re: Open 7.4 items