Re: Using unnest - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: Using unnest
Date
Msg-id h4frds$2g1$1@ger.gmane.org
Whole thread Raw
In response to Re: Using unnest  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: Using unnest
List pgsql-general
Jeff Davis wrote on 25.07.2009 22:44:
> It's generally hard to work with values of type anyarray. You have to
> cast them to text and then to a normal array type.
>
> For example:
>
>   select unnest(histogram_bounds::text::oid[]) from pg_stats where
>          tablename='pg_amop' and attname='amopopr';

Great, thanks

I tried casting the column to text[] (because it contains elements of type text) but I didn't think
of doing a two way cast.

Do I understand this correctly that by casting it first to text, I effectively create a new array
the same way I create one, when I supply a literal like '{1,2,3}'::text[]

Thomas



pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Using unnest
Next
From: "Daniel Verite"
Date:
Subject: Re: where is pg_resetxlog ?