Re: How to isolate the result of SELECT's? - Mailing list pgsql-general

From Jayadevan M
Subject Re: How to isolate the result of SELECT's?
Date
Msg-id OF76C71835.458B359E-ON652579C6.0013AAD3-652579C6.00141CE0@ibsplc.com
Whole thread Raw
In response to How to isolate the result of SELECT's?  (Andre Lopes <lopes80andre@gmail.com>)
List pgsql-general
Hi,
>
> I need to do an operation that I will use some SELECT's and get the
> results, but I want to have sure that those tables have not been
> changed with INSERT's or UPDATES during the operation.
>
> Example:
>
> BEGIN OPERATION
> Select field from table1;
> ...
> Select other_field from table2;
> ...
> END OPERATION
>
> How can I lock these tables to assure that the tables are not getting
> INSERTS's or UPDATE's during the operation?
>
If you set transaction isolation level to repeatable, the tables may undergo changes, but you will get repeatable reads. Explicitly locking the tables is another option.

http://www.postgresql.org/docs/current/static/explicit-locking.html
Regards,
Jayadevan





DISCLAIMER:


"The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect."





pgsql-general by date:

Previous
From: Doug Gorley
Date:
Subject: Re: Zero-length character breaking query?
Next
From: Aleksey Tsalolikhin
Date:
Subject: nice'ing the postgres COPY backend process to make pg_dumps run more "softly"