pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthew Peter <survivedsushi@yahoo.com>
To: paperinik 100 <paperinik_100@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: problems with array
Date: Tue, 18 Oct 2005 20:09:48 -0700 (PDT)
Message-ID: <20051019030948.80709.qmail@web35201.mail.mud.yahoo.com> (raw)
In-Reply-To: <BAY108-F2573522163DF0C1FC43D0DD27C0@phx.gbl>

Not sure if you got this figured out but I think

SELECT * from tb_cat WHERE id IN (SELECT
array_to_string(cat,',') as cat FROM tb_array WHERE
id=1);

is what your looking for?



--- paperinik 100 <paperinik_100@hotmail.com> wrote:

> PostgreSQL is 7.4.7.
> 
> My first table
> CREATE TABLE tb_cat (
> id INTEGER,
> desc text
> );
> INSERT INTO tb_cat VALUES (10, 'cat10');
> INSERT INTO tb_cat VALUES (20, 'cat20');
> INSERT INTO tb_cat VALUES (30, 'cat30');
> 
> My second table
> CREATE TABLE tb_array(
> id INTEGER,
> cat INTEGER[]
> );
> INSERT INTO tb_array VALUES(1, ARRAY [10, 20]);
> 
> When I write my select
> SELECT * from tb_cat WHERE id IN (SELECT cat FROM
> tb_array WHERE id=1);
> the output is:
> ERROR:  operator does not exist: integer = integer[]
> HINT:  No operator matches the given name and
> argument type(s). You may need 
> to add explicit type casts.
> 
> Can anyone help me?
> thanks.
> 
> 
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 



		
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/



view thread (5+ messages)  latest in thread

Message-ID: <20051019030948.80709.qmail@web35201.mail.mud.yahoo.com>
Permalink:  ../20051019030948.80709.qmail@web35201.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/20051019030948.80709.qmail@web35201.mail.mud.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: survivedsushi@yahoo.com, paperinik_100@hotmail.com
  Subject: Re: problems with array
  In-Reply-To: <20051019030948.80709.qmail@web35201.mail.mud.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox