Postgres and transactions
I'm attempting to use a ZSQL method to create a new user in a postgresql database (in the CREATE USER... sense), using Popy and postgres 7.0. The problem is that CREATE USER throws an error if you use it inside an explicit transaction. So: Does any know how to explicity turn off transactions for a particular ZSQL method? Do any of the other postgresql adapters work any better? (I'd test them, but I've had build troubles with the others.) Can I get away with just inserting the appropriate data into pg_user or is CREATE USER doing some other magic? I'd be grateful for any clues anyone has. John
John Morton wrote:
I'm attempting to use a ZSQL method to create a new user in a postgresql database (in the CREATE USER... sense), using Popy and postgres 7.0. The problem is that CREATE USER throws an error if you use it inside an explicit transaction.
I see no problem here: hannu=# begin; BEGIN hannu=# create user hu; CREATE USER hannu=# commit; COMMIT hannu=# maybe your zope user has no right to create new users ? ------------- Hannu
On Friday 11 May 2001 16:17, Hannu Krosing wrote:
John Morton wrote:
I'm attempting to use a ZSQL method to create a new user in a postgresql database (in the CREATE USER... sense), using Popy and postgres 7.0. The problem is that CREATE USER throws an error if you use it inside an explicit transaction.
I see no problem here:
hannu=# begin; BEGIN hannu=# create user hu; CREATE USER hannu=# commit; COMMIT hannu=#
I'm using postgres 7.0.3, snarfed from woody and built for potato, and I did test it with the psql console. I suspect that the behaviour has changed between 6.4 and 7 as create user supports group settings - necessitating insert/updates to two tables, and therefore wraping the lot in a transaction to keep create user an atomic statement. Guess you can't nest transactions :-) I think I'll update pg_user by hand for the time being, to get around the problem. John
participants (2)
-
Hannu Krosing -
John Morton