[OPEN-ILS-DEV] Patron Registration Error

Soulliere, Robert robert.soulliere at mohawkcollege.ca
Tue Mar 8 09:50:34 EST 2011


For setting the id sequence to max, we use:

SELECT SETVAL('actor.usr_id_seq', ( SELECT MAX(id) + 1 FROM actor.usr) );

For further reference on the topic, here is the postgresql documentation on the topic:
http://www.postgresql.org/docs/8.4/interactive/functions-sequence.html

Regards,
Robert

Robert Soulliere, BA (Hons), MLIS
Systems Librarian
Mohawk College Library
robert.soulliere at mohawkcollege.ca
Telephone: 905 575 1212 x3936
Fax: 905 575 2011
________________________________________
From: open-ils-dev-bounces at list.georgialibraries.org [open-ils-dev-bounces at list.georgialibraries.org] On Behalf Of Martha Driscoll [driscoll at noblenet.org]
Sent: March 8, 2011 9:43 AM
To: Evergreen Development Discussion List
Subject: [OPEN-ILS-DEV] Patron Registration Error

I'm running a test system on 2.0.1.  We added 5 users in the client (id
2-6) and then loaded 117 more users by inserting directly into the usr,
card, and usr_address tables (id 7-123).  Now when we try to store a new
user in the client, we get a database error saying 'duplicate key value
violates unique constraint "usr_pkey"'.  The postgresql-8.4-main.log
shows that user id 7,8,9 etc. were tried.  Each time we click save, the
user id increments by one.  Why isn't Evergreen checking the max(id) in
the usr table?  Did I do something wrong when I loaded the records?  Is
there a way to bump the usr.id to 124 so I can store a new patron record?

Here is an error in the postgresql-8.4-main.log.  The usr.id it is
trying is 22.  If we try to save again, it will use 23 etc.

2011-03-07 17:05:21 EST ERROR:  duplicate key value violates unique
constraint "usr_pkey"
2011-03-07 17:05:21 EST STATEMENT:  INSERT INTO actor.usr (profile,
juvenile, usrname, claims_returned_count, family_name, first_given_name,
expire_date, id, net_access_level, ident_type, active, home_ou,
last_xact_id, passwd, second_given_name, barred, master_account)
         VALUES ('11', 'f', '21458000270368', '0', 'Cat', 'Felix',
'2014-03-07T00:00:00-05:00', '22', '1', '1', 't', '68',
'1299535520.885932935.48171580426', '6796', 'T', 'f', 'f')

--
Martha Driscoll
Systems Manager
North of Boston Library Exchange
Danvers, Massachusetts
www.noblenet.org


This E-mail contains privileged and confidential information intended
only for the individual or entity named in the message.  If the reader
of this message is not the intended recipient, or the agent responsible
to deliver it to the intended recipient, you are hereby notified that
any review, dissemination, distribution or copying of this communication
is prohibited.  If this communication was received in error, please
notify the sender by reply E-mail immediately, and delete and destroy
the original message.


More information about the Open-ils-dev mailing list