Re: query to match '\N'

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: query to match '\N'
Date: 2007-07-30 09:34:33
Message-ID: 46ADB0A9.9020601@magproductions.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bertram Scharpf wrote:
> Hi,
>
> Am Freitag, 27. Jul 2007, 18:35:21 -0000 schrieb pc:
>> I have a table test with columns col1 col2.col2 contains an entry
>> '\N' .I want to select all entries which have '\N' in col2.How do i
>> do that?
>>
>> select * from test where col2 like '\N' ;
>> select * from test where col2 like '\\N' ;
>
> select * from test where col2 like E'\\\\N';
> select * from test where col2 = E'\\N';
>
> Why use `like' here at all?

Presumably he wanted col2 like E'%\\\\N%'.
But doesn't \N mean NULL, or would the OP be looking for literal '\N'
strings in his data? Because if he's looking for NULLs it may be better
to query for col2 IS NULL.

--
Alban Hertroys
alban(at)magproductions(dot)nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede

// Integrate Your World //

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nis Jørgensen 2007-07-30 10:01:09 Re: query to match '\N'
Previous Message Luca Ciciriello 2007-07-30 09:33:55 PQntuples return type