Re: BUG #1161: User permissions are kept, even if user is

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Martin <martin(at)4finger(dot)net>, PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #1161: User permissions are kept, even if user is
Date: 2004-06-09 14:04:22
Message-ID: Pine.LNX.4.60.0406091540020.23621@sablons.cri.ensmp.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


Dear Tom,

>> I was thinking that any integer attribute of any tuple in a shared
>> relation would be ok to store a sequence value.
>
> Certainly not --- when there are multiple versions of the tuple because
> of MVCC rules, which do you use?

I understand you concern, but I think the troubles depends on how the
value is actually used. I agree it would not be a real sequence with
nextval() and so, but the purpose is just to find an non already used
sysid.

The locking mecanism on the update of this special account would insure
that the there is no possible conflict.

<begin>
SELECT usesysid AS old_sysid_value
FROM pg_shadow WHERE usename='next_sysid' FOR UPDATE;

// iterate to find some new sysid starting from previous value

UPDATE usesysid = new_found_sysid WHERE usename='next_sysid';

INSERT new user with old_sysid_value;
<end>

So the concern I would see is more on the fact that there is a lock that
would block concurrent "create user", especially if done in a long
transaction, so IMHO this is performance/contention issue, but there is no
real semantical issue. What is lost is the no-lock nature of the sequence
update with nextval.

I'm not sure the performance would be a big trouble, because create user
are not issued that often, and I would not expect them to appear within a
large transaction.

Anyway I'm planing to hace a look at the real thing first (shared seq).
So no worry, and thanks for your question.

--
Fabien Coelho - coelho(at)cri(dot)ensmp(dot)fr

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2004-06-09 15:00:08 Re: BUG #1145: silent REVOKE failures
Previous Message Tom Lane 2004-06-09 13:34:19 Re: BUG #1161: User permissions are kept, even if user is