Обсуждение: Calling a Postgres utility in pgpsql function

Поиск
Список
Период
Сортировка

Calling a Postgres utility in pgpsql function

От
Vish Phaneendra
Дата:
Hi,

Is it possible to call a postgres utility from pgpsql function? I'm trying to get the table definition using the pgpsql function.

CREATE FUNCTION table_definition(text) RETURNS text AS $$
pg_dump -st $1
$$ LANGUAGE plpgsql;

Rgds,
Vish

Re: Calling a Postgres utility in pgpsql function

От
Guillaume Lelarge
Дата:
Vish Phaneendra a écrit :
> [...]
> Is it possible to call a postgres utility from pgpsql function? I'm
> trying to get the table definition using the pgpsql function.
> 
> CREATE FUNCTION table_definition(text) RETURNS text AS $$
> pg_dump -st $1
> $$ LANGUAGE plpgsql;
> 

No, you can't with PL/pgsql. But you can certainly do that with
untrusted PL like PL/Perlu or PL/Pythonu.


-- 
Guillaume.http://www.postgresqlfr.orghttp://dalibo.com


Re: Calling a Postgres utility in pgpsql function

От
"Sufficool, Stanley"
Дата:
This could be done with C if the author of this wonderful utility decided to make it a shared library ;)

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> Guillaume Lelarge
> Sent: Tuesday, June 09, 2009 12:59 AM
> To: Vish Phaneendra
> Cc: pgadmin-support@postgresql.org
> Subject: Re: [pgadmin-support] Calling a Postgres utility in
> pgpsql function
>
>
> Vish Phaneendra a écrit :
> > [...]
> > Is it possible to call a postgres utility from pgpsql function? I'm
> > trying to get the table definition using the pgpsql function.
> >
> > CREATE FUNCTION table_definition(text) RETURNS text AS $$
> pg_dump -st
> > $1 $$ LANGUAGE plpgsql;
> >
>
> No, you can't with PL/pgsql. But you can certainly do that with
> untrusted PL like PL/Perlu or PL/Pythonu.
>
>
> --
> Guillaume.
>  http://www.postgresqlfr.org
>  http://dalibo.com
>
> --
> Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-support
>