Search Postgresql Archives

Re: What is the difference?

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

 



Oluwatope Akinniyi wrote:
> This 
> SELECT 1 WHERE '95b5a221aeba15c' IN (E'\'' || replace('95b5a221aeba15c+fb4e7219ab898ce+b08586cb81059f9','+',''',''') || E'\'') returns no row while

This returns a string with text '95b...', '...', '...'

> SELECT 1 WHERE '95b5a221aeba15c' IN ('95b5a221aeba15c','fb4e7219ab898ce','b08586cb81059f9') returns a row.

This is three values.

You could either use strpos() on the raw string (as long as you know you
 won't get partial/multiple matches). OR split the string to an array:


SELECT 1
WHERE
'95b5a221aeba15c' = ANY(
  string_to_array(
    '95b5a221aeba15c+fb4e7219ab898ce+b08586cb81059f9',
    '+'
  )
);

-- 
  Richard Huxton
  Archonet Ltd

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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