Search Postgresql Archives

Re: query to match '\N'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx

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 //

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux