Re: CREATE DATABASE cannot be executed from a function or multi-command string - Mailing list pgsql-hackers

From Dave Page
Subject Re: CREATE DATABASE cannot be executed from a function or multi-command string
Date
Msg-id 46F7B92E.9040004@postgresql.org
Whole thread Raw
In response to Re: CREATE DATABASE cannot be executed from a function or multi-command string  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan wrote:
> 
> src/bin/psql/common.c has a routine that lets psql get round this, by 
> not sending a BEGIN in the case of the offending statements. I have no 
> idea if this might be helpful for pgadmin though.

Yeah, unfortunately it's not that we wrap the statement in a begin/end -  we rely on the fact that each call to PQexec
isimplicitly a single 
 
transaction.

We're aware of course that CREATE DATABASE can't run in a transaction 
block but just turned a blind eye to that on the grounds that it was 
much more likely to fail than any of the other statements following it 
in the multi-statement and we weren't about to start rolling it back 
ourselves anyway.

Thanks, Dave.


pgsql-hackers by date:

Previous
From: Martin Pihlak
Date:
Subject: Re: stored procedure stats in collector
Next
From: Thea
Date:
Subject: Re: LIKE wildcards escaping problem