postgresql - CREATE DATABASE inside transaction -


according postgresql docs;

create database cannot executed inside transaction block. 

is there technical reason this?

when try it, error:

error:  create database cannot run inside transaction block 

this comes src/backend/access/transam/xact.c (line 3023 on sources, varies version), in preventtransactionchain(...).

the comment there explains that:

this routine called statements must not run inside transaction block, typically because have non-rollback-able side effects or internal commits.

for create database it's called src/backend/tcop/utility.c in standard_processutility under case t_createdbstmt, unfortunately there isn't informative comment says why create database isn't safe run in transaction.

looking @ sources, can see 1 thing forces checkpoint.

overall, though, don't see screams out "we can't transactionally". it's more "we haven't implemented functionality transactionally".


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -