Search Postgresql Archives

Re: Array intersection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 17 Oct 2007 11:26:05 -0700
David Fetter <david@xxxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux