Re: Array intersection - Mailing list pgsql-general

From Josh Trutwin
Subject Re: Array intersection
Date
Msg-id 20071017142031.709c5ded@sinkhole.intrcomm.net
Whole thread Raw
In response to Re: Array intersection  (David Fetter <david@fetter.org>)
List pgsql-general
On Wed, 17 Oct 2007 11:26:05 -0700
David Fetter <david@fetter.org> wrote:

> > Doesn't appear to work on 8.1:
> >
> > psql=> select array_intersect('{1,2,3}', '{2,3,4}');
> > ERROR:  could not determine anyarray/anyelement type because input
> > has type "unknown"
>
> As mentioned in the "release notes" ;), it's up to you to ensure
> that the arrays have the right types, so you'd write the above as:
>
> SELECT array_intersect('{1,2,3}'::int[], '{2,3,4}'::int[]);

Ah - I saw that but I figured that just meant you couldn't do
something like this:

SELECT array_intersect('{1,2,3}', '{"a","b","c"}');

So basically with this array intersect function you always need to
cast the inputs.

Josh

pgsql-general by date:

Previous
From: David Fetter
Date:
Subject: Re: Array intersection
Next
From: Richard Huxton
Date:
Subject: Re: Poor Plan selected w/ not provided a date/time but selecting date/time from a table