| From: | Josh Trutwin <josh(at)trutwins(dot)homeip(dot)net> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: Array intersection | 
| Date: | 2007-10-17 19:20:31 | 
| Message-ID: | 20071017142031.709c5ded@sinkhole.intrcomm.net | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Wed, 17 Oct 2007 11:26:05 -0700
David Fetter <david(at)fetter(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Richard Huxton | 2007-10-17 19:37:18 | Re: Poor Plan selected w/ not provided a date/time but selecting date/time from a table | 
| Previous Message | David Fetter | 2007-10-17 18:26:05 | Re: Array intersection |