Skip site navigation (1) Skip section navigation (2)

Re: Is there a way to run CREATE TABLESPACE within a stored procedure?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: "Abraham, Danny" <danny_abraham(at)bmc(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Is there a way to run CREATE TABLESPACE within a stored procedure?
Date: 2007-07-20 14:14:15
Message-ID: 20070720141415.GB85514@winnie.fuhr.org (view raw or flat)
Thread:
Lists: 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

In response to

pgsql-admin by date

Next:From: Jessica RichardDate: 2007-07-20 16:06:53
Subject: "_" in a serach pattern
Previous:From: Dimitri FontaineDate: 2007-07-20 13:01:49
Subject: SkyTools Londiste HowTo

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group