Re: Finding a value in an array field

From: "Roberto (SmartBit)" <roberto(at)smartbit(dot)inf(dot)br>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Finding a value in an array field
Date: 2002-10-18 13:49:55
Message-ID: 001401c276ad$3f681240$1501a8c0@NoteBook
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

thanks Jeff

this is my SQL command:

select pg_attribute.attname from pg_index, pg_attribute, pg_class
where indrelid=pg_class.oid and
(indrelid=pg_attribute.attrelid and pg_attribute.attnum IN indkey) and
pg_class='mytablename' and idxisprimary

I'm trying to return fields of MyTable's primary key!!

the field 'indkey' is an array!!

if thera are other ways... please, tell me how..

tia

----- Original Message -----
From: "Jeff Davis" <list-pgsql-general(at)empires(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Sent: Thursday, October 17, 2002 9:08 PM
Subject: Re: [GENERAL] Finding a value in an array field

I think you need to look at the functions in /contrib. I don't think you can
do it just in SQL.

Regards,
Jeff Davis

On Thursday 17 October 2002 05:45 pm, Roberto (SmartBit) wrote:
> How can I know if a value is into an array field?
>
> something like:
>
> SELECT field1, field2 FROM myTableName
> WHERE 10 in myArrayField
>
> PS: I do NOT know then number of array elements!
>
> tia
>
> Roberto de Amorim - +55 48 346-2243
> Software engineer at SmartBit Software
> Delphi and Interbase consultant
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message stephane tessier 2002-10-18 13:58:50
Previous Message Ian Harding 2002-10-18 13:38:19 I Never Thought I Would See