pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedCreate database/table using postgresql stored function
4+ messages / 2 participants
[nested] [flat]
* Create database/table using postgresql stored function
@ 2010-12-08 09:43 Manasi Save <manasi.save@artificialmachines.com>
0 siblings, 1 reply; 4+ messages in thread
From: Manasi Save @ 2010-12-08 09:43 UTC (permalink / raw)
To: pgsql-admin
Hi All,
I want to create postgresql database and tables using stored functions.
Does postgresql support create statements in stored functions.
Regards,
Manasi
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Create database/table using postgresql stored function
@ 2010-12-08 10:04 Manasi Save <manasi.save@artificialmachines.com>
0 siblings, 1 reply; 4+ messages in thread
From: Manasi Save @ 2010-12-08 10:04 UTC (permalink / raw)
To: pgsql-admin; Manasi Save <manasi.save@artificialmachines.com>
Also I want to query multiple databases from stored functions from one
central database.
for ex :=
CREATE OR REPLACE FUNCTION test () RETURNS AS
$BODY$
SELECT * FROM db2.volume
ORDER BY db2.volume.volumeID
$BODY$
LANGUAGE sql STABLE
COST 100
ROWS 1000;'
I have implemented this thing in mysql but I am not really sure is it
possible in postgresql.
--
Regards,
Manasi Save
On Wed, 08 Dec 2010 04:43:50 -0500, Manasi Save wrote:
Hi All,
I want to create postgresql database and tables using stored functions.
Does postgresql support create statements in stored functions.
Regards,
Manasi
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Create database/table using postgresql stored function
@ 2010-12-08 10:47 Guillaume Lelarge <guillaume@lelarge.info>
parent: Manasi Save <manasi.save@artificialmachines.com>
0 siblings, 0 replies; 4+ messages in thread
From: Guillaume Lelarge @ 2010-12-08 10:47 UTC (permalink / raw)
To: Manasi Save <manasi.save@artificialmachines.com>; +Cc: pgsql-admin
Le 08/12/2010 10:43, Manasi Save a écrit :
> [...]
> I want to create postgresql database and tables using stored functions.
>
> Does postgresql support create statements in stored functions.
>
You cannot use CREATE DATABASE from a stored function or in a
multistatements query. But AFAICT, any of the other DDL statements are
available in a stored function (or in a transaction for that matter).
--
Guillaume
http://www.postgresql.fr
http://dalibo.com
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Create database/table using postgresql stored function
@ 2010-12-08 10:48 Guillaume Lelarge <guillaume@lelarge.info>
parent: Manasi Save <manasi.save@artificialmachines.com>
0 siblings, 0 replies; 4+ messages in thread
From: Guillaume Lelarge @ 2010-12-08 10:48 UTC (permalink / raw)
To: Manasi Save <manasi.save@artificialmachines.com>; +Cc: pgsql-admin
Le 08/12/2010 11:04, Manasi Save a écrit :
> Also I want to query multiple databases from stored functions from one
> central database.
> for ex :=
>
> CREATE OR REPLACE FUNCTION test () RETURNS AS
> $BODY$
>
> SELECT * FROM db2.volume
> ORDER BY db2.volume.volumeID
>
> $BODY$
> LANGUAGE sql STABLE
> COST 100
> ROWS 1000;'
>
> I have implemented this thing in mysql but I am not really sure is it
> possible in postgresql.
Nope, you can't use the same kind of queries. You need to install dblink
or PL/proxy to get that kind of capacity.
--
Guillaume
http://www.postgresql.fr
http://dalibo.com
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2010-12-08 10:48 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-12-08 09:43 Create database/table using postgresql stored function Manasi Save <manasi.save@artificialmachines.com>
2010-12-08 10:47 ` Guillaume Lelarge <guillaume@lelarge.info>
2010-12-08 10:04 Re: Create database/table using postgresql stored function Manasi Save <manasi.save@artificialmachines.com>
2010-12-08 10:48 ` Guillaume Lelarge <guillaume@lelarge.info>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox