problems with array

From: "paperinik 100" <paperinik_100(at)hotmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: problems with array
Date: 2005-10-15 08:49:15
Message-ID: BAY108-F2573522163DF0C1FC43D0DD27C0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Mike Plemmons 2005-10-17 03:24:44 Question about functions
Previous Message Dau Sy Manh 2005-10-15 02:38:58 Re: copy tables