Re: [GENERAL] Using unnest

2009-07-25 Thread Tom Lane
Jeff Davis writes: > So, my strategy will only work if the array type you're trying to cast > to has a cast from text. As of (IIRC) 8.3, every type does have a cast from text. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To mak

Re: [GENERAL] Using unnest

2009-07-25 Thread Jeff Davis
On Sat, 2009-07-25 at 22:54 +0200, Thomas Kellerer wrote: > 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[] Similar, but not quite the same. '{1,2,3}'::text[] is actual

Re: [GENERAL] Using unnest

2009-07-25 Thread Thomas Kellerer
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'; G

Re: [GENERAL] Using unnest

2009-07-25 Thread Jeff Davis
On Sat, 2009-07-25 at 22:24 +0200, Thomas Kellerer wrote: > I was trying to use information from the pg_stats view, when I remembered > that 8.4 now has the cool > unnest function. > > However I can't seem to get this to work with a column defined as anyarray. It's generally hard to work with v

[GENERAL] Using unnest

2009-07-25 Thread Thomas Kellerer
Hi, I was trying to use information from the pg_stats view, when I remembered that 8.4 now has the cool unnest function. However I can't seem to get this to work with a column defined as anyarray. So my query is: select histogram_bounds from pg_stats where tablename = 'my_table' and attname