[rt-users] Users.id and Groups.id

Tim Cutts tjrc at sanger.ac.uk
Mon May 7 14:14:26 EDT 2012


On 7 May 2012, at 18:54, Paul Tomblin wrote:

> I noticed that the database schema specifies different sequences for
> the id fields in the users and groups tables.  However, it appears
> that RT doesn't actually use those sequences - "select
> currval('user_id_seq')" returns 1 even though I have a bunch of users
> created.  The other thing I noticed is that the users.id and groups.id
> don't have any common numbers - i.e. I've got users with ids 26, 28
> and 32, and groups with ids of 27, 29 and 31.  Can I rely on that
> being true, or is it just a coincidence?

It might be true (since both users and groups have an entry in the Principals table) but the purist in me is screaming "assume it isn't true".  If you assume it isn't true, whatever code you're considering writing will always work.  If you assume it is true, and it later turns out not to be, you're going to get burned.  It might also be one of those things where it's true on one database backend, but not on another.

What are you actually trying to do?

Tim

-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 



More information about the rt-users mailing list