Re: Trouble with locking tables - reg.
От
Dave Cramer
Тема
Re: Trouble with locking tables - reg.
Дата
Msg-id
1086885362.5639.183.camel@localhost.localdomain
Ответ на
Trouble with locking tables - reg. (Shanmugasundaram Doraisamy)
Список
Дерево обсуждения
Trouble with locking tables - reg. Shanmugasundaram Doraisamy <shan@ceedees.com>
Re: Trouble with locking tables - reg. Dave Cramer <pg@fastcrypt.com>
Functions can't have transactions inside of them You need to start the transaction then call the function. couple of questions though why not use sequences ? Then you have no concurrency issues. They are guaranteed to be incremented. Also you can use select for update, instead of locking the entire table. Dave On Wed, 2004-06-09 at 23:39, Shanmugasundaram Doraisamy wrote: > Dear Group, > We are using Postgresql 7.3.4 on Redhat 8.0 with > Java 1.4.2. We are developing our applications in Java. We call stored > procedures from the java program. Order numbers are generated by many > departments in the Hospital. We manitain a single table from which to > select the order number. The way this works is that the order numbers > are released for reuse if the order has been completed. We wrote a > procedure in plpgsql with a transaction which locks the table for > concurrency problem. When more than one person tries to generate an > order number (by running the java program) still there arise the > concurrency problem. > > We tried to check how the procedures with transaction that > locks the table works . what we did to check the procedure was as follows > we have one database server. > we took two computer systems. in both system we opened > one terminal (linux). > let the value of the order number be 50. > [1] in one system's terminal we started the transaction > using begin; lock table
В списке pgsql-jdbc по дате отправления