Re: array_map not SQL accessible?

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: array_map not SQL accessible?
Date: 2009-01-30 18:56:29
Message-ID: 20090130185629.GB7428@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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_class c 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)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-01-30 19:06:35 ecpg grammar in CVS is annoying
Previous Message Alvaro Herrera 2009-01-30 18:35:48 Re: array_map not SQL accessible?