Skip site navigation (1) Skip section navigation (2)

ERROR: operator does not exist: integer = integer[]

From: A Gilmore <agilmore(at)shaw(dot)ca>
To: Postgresql Mailing list <pgsql-novice(at)postgresql(dot)org>
Subject: ERROR: operator does not exist: integer = integer[]
Date: 2005-11-19 03:52:35
Message-ID: 437EA183.5040001@shaw.ca (view raw or flat)
Thread:
Lists: pgsql-novice
Hello,

Im having problems trying to concatenate two arrays in a plpgsql 
function.  Doing the following :

--
CREATE TABLE t1 (
	id1		int,
	id2		int
);

INSERT INTO t1 (id1, id2) VALUES (1,3);
INSERT INTO t1 (id1, id2) VALUES (1,4);
INSERT INTO t1 (id1, id2) VALUES (1,5);
INSERT INTO t1 (id1, id2) VALUES (1,6);
INSERT INTO t1 (id1, id2) VALUES (2,7);
INSERT INTO t1 (id1, id2) VALUES (2,8);

CREATE OR REPLACE FUNCTION tmpfunc(int[]) RETURNS int[] AS '
DECLARE
	Ids ALIAS FOR $1;
	AllIds int[];
BEGIN
	AllIds := Ids || array(select id2 from t1 where id1 in (Ids) group by id2);
	RETURN AllIds;
END
' LANGUAGE 'plpgsql';

SELECT * FROM tmpfunc(array[1,2]);
ERROR:  operator does not exist: integer = integer[]

--

What am I doing wrong here?

Thank you in advance,
- A Gilmore

Responses

pgsql-novice by date

Next:From: A GilmoreDate: 2005-11-19 04:59:50
Subject: Re: ERROR: operator does not exist: integer = integer[]
Previous:From: Bill DikaDate: 2005-11-19 03:44:33
Subject: Re: Application using PostgreSQL as a back end (experienced programmers please)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group