pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Is there a way to run CREATE TABLESPACE within a stored procedure?
2+ messages / 2 participants
[nested] [flat]

* Is there a way to run CREATE TABLESPACE within a stored procedure?
@ 2007-07-19 11:53 Abraham, Danny <danny_abraham@bmc.com>
  2007-07-20 14:14 ` Re: Is there a way to run CREATE TABLESPACE within a stored procedure? Michael Fuhr <mike@fuhr.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Abraham, Danny @ 2007-07-19 11:53 UTC (permalink / raw)
  To: pgsql-admin

Fails on: Cannot run inside a transaction block.
Thanks
Danny




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Is there a way to run CREATE TABLESPACE within a stored procedure?
  2007-07-19 11:53 Is there a way to run CREATE TABLESPACE within a stored procedure? Abraham, Danny <danny_abraham@bmc.com>
@ 2007-07-20 14:14 ` Michael Fuhr <mike@fuhr.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Fuhr @ 2007-07-20 14:14 UTC (permalink / raw)
  To: Abraham, Danny <danny_abraham@bmc.com>; +Cc: pgsql-admin

On Thu, Jul 19, 2007 at 02:53:50PM +0300, Abraham, Danny wrote:
> Fails on: Cannot run inside a transaction block.

PostgreSQL functions run in the context of a transaction so they
can't execute statements that aren't allowed inside a transaction
block.  A workaround is to have the function connect to the database
via contrib/dblink (or dbi-link, or some such mechanism) and execute
the statements over that connection.  Caveat: if the function's
transaction rolls back then statements already committed over the
connection won't be rolled back.

-- 
Michael Fuhr



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-07-20 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-19 11:53 Is there a way to run CREATE TABLESPACE within a stored procedure? Abraham, Danny <danny_abraham@bmc.com>
2007-07-20 14:14 ` Michael Fuhr <mike@fuhr.org>

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