Re: Using unnest

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Using unnest
Date: 2009-07-25 20:54:27
Message-ID: h4frds$2g1$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2009-07-25 21:13:11 Re: where is pg_resetxlog ?
Previous Message Jeff Davis 2009-07-25 20:44:35 Re: Using unnest