Created
March 23, 2012 17:00
-
-
Save jackdouglas/2172779 to your computer and use it in GitHub Desktop.
postgres locking (re http://dba.stackexchange.com/a/15442/1396)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set role dba; | |
create role stack; | |
grant stack to dba; | |
create schema authorization stack; | |
set role stack; | |
-- | |
create table film(film_id integer primary key, release_year integer not null); | |
create table film_actor(actor_id integer, film_id integer references film, primary key (actor_id, film_id)); | |
insert into film(film_id, release_year) values(1,2004); | |
begin; | |
insert into film_actor(actor_id, film_id) values(1,1); | |
--in session 2: update film set release_year=2005 where film_id=1; | |
commit; | |
-- | |
drop schema stack cascade; | |
set role dba; | |
drop role stack; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment