[Zope] Postgres and transactions

John Morton jwm@plain.co.nz
Sat, 12 May 2001 19:05:03 +1200


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 postgr=
esql
>  > 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=3D# begin;
>  BEGIN
>  hannu=3D#  create user hu;
>  CREATE USER
>  hannu=3D# commit;
>  COMMIT
>  hannu=3D#

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=20
between 6.4 and 7 as create user supports group settings - necessitating=20
insert/updates to two tables, and therefore wraping the lot in a transact=
ion
to keep create user an atomic statement. Guess you can't nest transaction=
s :-)

I think I'll update pg_user by hand for the time being, to get around the=
=20
problem.

John