[GENERAL] regarding contains operator

2006-03-08 Thread surabhi.ahuja
i have a field whose type is varchar(16)

and the field is multivalued, in the sense it is of 
the form 

abc\def\tez
(i.e. backslash separed values)

please tell me is there any operator available 
which enables me to do the following:

field contains some value

eg field contains "abc" should return true, similary for def or tez

if it is not ther can i write my own operators? abd use them please send me 
the link where i can find documnetation on the same
thanks,
regards
Surabhi Ahuja


Re: [GENERAL] regarding contains operator

2006-03-08 Thread Ragnar
On miĆ°, 2006-03-08 at 15:13 +0530, surabhi.ahuja wrote:
  
 if it is not ther can i write my own operators? abd use them please
 send me the link where i can find documnetation on the same

http://www.postgresql.org/docs/8.1/interactive/extend.html
http://www.postgresql.org/docs/8.1/interactive/xoper.html

gnari



---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] regarding contains operator

2006-03-08 Thread Michael Fuhr
On Wed, Mar 08, 2006 at 03:13:40PM +0530, surabhi.ahuja wrote:
 please tell me is there any operator available which enables me to do the 
 following:
  
 field contains some value
  
 eg field contains abc should return true, similary for def or tez

See Pattern Matching in the Functions and Operators chapter of
the documentation.

http://www.postgresql.org/docs/8.1/interactive/functions-matching.html

You mentioned that your data contains backslashes.  Backslashes
have special meaning to the string parser and in search patterns,
so if you need to match a literal backslash then you might need to
write more backslashes than you'd expect.  If you're using 8.0 or
later then dollar quotes can make writing patterns easier because
they don't treat backslashes as special.

http://www.postgresql.org/docs/8.1/interactive/sql-syntax.html#SQL-SYNTAX-DOLLAR-QUOTING

-- 
Michael Fuhr

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

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


Re: [GENERAL] regarding contains operator

2006-03-08 Thread Tom Lane
surabhi.ahuja [EMAIL PROTECTED] writes:
  i have a field whose type is varchar(16)
 and the field is multivalued, in the sense it is of the form

 abc\def\tez
 (i.e. backslash separed values)

To be blunt, this is a really poorly-chosen data representation.
To point out just one problem, backslashes in the values will cause
you headaches.

Perhaps an array field would serve you better.  Then the specific
operation you are considering would be foo = ANY(arrayfield).

regards, tom lane

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

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