Tue Feb 17 13:22:17 PST 2009
- Previous message: [Slony1-general] slony 1.2.x to 2.y upgrade status?
- Next message: [Slony1-general] permission denied for sequence sl_action_seq - revisited
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Slony People, We have a 30 gigabyte database handling about 100M queries a day. We recently started load balancing with slony and pgpool and it's working pretty well. (I've documented a lot of stuff in our wiki -- will definitely turn it into a post.) Anyway we have been getting a few "permission denied for sequence sl_action_seq" and had come across http://www.mail-archive.com/slony1-general@gborg.postgresql.org/msg03302.html where it was asserted that "Calling lastval() instead of currval() is not safe against concurrent clients to begin with" and :However, unless you've stumbled across a bug in Postgres itself, there is nothing there that would cause any of the code to access a sequence different from the one your application specifies in the call." I'm pretty sure neither statement is quite true. We determined that using currval and lastval *without explicitly stating the sequence* will substitute a sequence from the slony schema behind your back. I've pasted an example here. In the first case, we select lastval and we a sequence from slony instead of what we want. (This is on the master.) In the second case where we explicitly name the sequence, it works. I don't know that this is a bug or what it would take to fix it, but it should probably be documented that you can't use lastval() without an explicit sequence ID when doing slony, or something, anyway. Thanks for great software. Karl sdidata=# BEGIN; BEGIN asdidata=# INSERT INTO ad_campaign(user_id,type,target) values(1,'airport','KMOO'); INSERT 0 1 asdidata=# SELECT lastval(); lastval --------- 157122 (1 row) asdidata=# ROLLBACK; ROLLBACK asdidata=# old way. asdidata=# begin; BEGIN asdidata=# INSERT INTO ad_campaign(user_id,type,target) values(1,'airport','KMOO'); INSERT 0 1 asdidata=# SELECT currval('ad_campaign_id_seq'); currval --------- 122 (1 row) asdidata=# ROLLBACK; ROLLBACK asdidata=# new way
- Previous message: [Slony1-general] slony 1.2.x to 2.y upgrade status?
- Next message: [Slony1-general] permission denied for sequence sl_action_seq - revisited
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list