Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-17 Thread andreas
Zitat von Siva Palanisamy : Hi Alban, Thanks for the reply. 1) I'm using PostgreSQL 8.1; So, I can't use RETURNING clause! You should Upgrade ASAP! 8.1 is 'out of lifetime'. Regards, Andreas -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your sub

Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-17 Thread Siva Palanisamy
.com] Sent: Thursday, November 17, 2011 1:20 PM To: Siva Palanisamy Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] How to lock and unlock table in postgresql On 17 Nov 2011, at 7:10, Siva Palanisamy wrote: > If there is a better solution, kindly let me know. > > CREATE OR R

Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread Alban Hertroys
On 17 Nov 2011, at 7:10, Siva Palanisamy wrote: > If there is a better solution, kindly let me know. > > CREATE OR REPLACE FUNCTION Fun() > RETURNS VOID AS ' > DECLARE > Id INTEGER; > BEGIN > INSERT INTO table1 VALUES (DEFAULT, ''Sample'', DEFAULT); > SELECT MAX(id) I

Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread John R Pierce
On 11/16/11 11:16 PM, Siva Palanisamy wrote: Thanks for the solution. If I use currval('sqlname') in a loop of 7 records, what will happen if a record is inserted manually? I guess it will alter the sequences, and wrong values/chain might be introduced in foreign tables in the below functi

Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread Siva Palanisamy
rify me on this? Thanks and Regards, Siva. -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John R Pierce Sent: Thursday, November 17, 2011 12:05 PM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] How to lock and un

Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread John R Pierce
On 11/16/11 10:23 PM, John R Pierce wrote: use nextval('seqname') sorry, I meant, currval('seqname') ps. -- john r pierceN 37, W 122 santa cruz ca mid-left coast -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)

Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread John R Pierce
On 11/16/11 10:10 PM, Siva Palanisamy wrote: If there is a better solution, kindly let me know. use nextval('seqname') ... full transactional integrity without any blocking or locking. -- john r pierceN 37, W 122 santa cruz ca mid-left