Re: array_map not SQL accessible? - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: array_map not SQL accessible?
Date
Msg-id 20090130185629.GB7428@alvh.no-ip.org
Whole thread Raw
In response to Re: array_map not SQL accessible?  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: array_map not SQL accessible?
List pgsql-hackers
Alvaro Herrera wrote:
> Tom Lane wrote:

> > > As it happens, I need to use it in the pg_dump support for TOAST
> > > reloptions.
> > 
> > Maybe something involving
> >     ARRAY(SELECT foo(x) FROM UNNEST(arrayvariable) x)
> 
> Hmm, I'll have a look at this.

It seems there's something wrong here.

alvherre=# select c.oid,tc.oid,c.relname, c.reloptions, array(select 'toast.' || x from unnest(tc.reloptions) x) from
pg_classc join pg_class tc on c.reltoastrelid = tc.oid where c.relname = 'foo';
 
-[ RECORD 1
]------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
oid        | 16395
oid        | 16398
relname    | foo
reloptions | {fillfactor=10,bogusopt=15}
?column?   |
{toast.fillfactor=20,toast.\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F}

To reproduce easily:

create table text (a text[]);
insert into text values ('{fillfactor=10,bogusval=20}');
select array(select 'foobar.' || x from unnest(a) x) from text;

-- 
Alvaro Herrera       Valdivia, Chile   ICBM: S 39º 49' 18.1", W 73º 13' 56.4"
"I can see support will not be a problem.  10 out of 10."    (Simon Wittber)
(http://archives.postgresql.org/pgsql-general/2004-12/msg00159.php)


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: array_map not SQL accessible?
Next
From: Alvaro Herrera
Date:
Subject: ecpg grammar in CVS is annoying