SELECT ... FOR UPDATE - Mailing list pgsql-general

From Guillaume Houssay
Subject SELECT ... FOR UPDATE
Date
Msg-id 004c01c3c75f$e59343c0$8600a8c0@camille
Whole thread Raw
List pgsql-general
I need som ehelp concerning queries using SLEECT ... FOR UPDATE
 
I have two tables (see description below)
 
One is the table of reference, the other one is a table where i have daily infoirmation
 
I want to check the differences on the two tables based on the fields omc_index and bsc for each cellname.
Then when I have inconsistency, I want to update the first table with information picked up in the second table.
 
My query is the following
 
Select t1.omc_index, t1.bsc from edw_object t1, edw_object_ref t2 WHERE t1.cellname=t2.cellname and t1.day='20031214' and (t1.omc_index<>t2.omc_index or t1.bsc<>t2.bsc) FOR UPDATE of t2;
I can not find much information on FOR UPDATE.
 
Thank you for your help
 
*************************
 
 Table "public.edw_object_ref"
     Column      |  Type   | Modifiers
-----------------+---------+-----------
 edw_group_table | text    |
 omc_index       | text    |
 cellname        | text    |
 cellid          | integer |
 bsc             | text    |
 country         | text    |
 super_region    | text    |
 region          | text    |
 area            | text    |
 subarea         | text    |
 zone            | text    |
 ibc             | text    |
 road            | text    |
 trial           | text    |
 subtrial        | text    |
 date            | integer |
Indexes: ix_cellname_edw_object_ref btree (cellname),
         ix_omc_index_edw_object_ref btree (omc_index)
 Table "public.edw_object"
     Column      |         Type          | Modifiers
-----------------+-----------------------+-----------
 cellname        | character varying(50) |
 bsc             | text                  |
 region          | text                  |
 edw_group_table | text                  |
 omc_index       | text                  |
 day             | integer               |
 cellid          | integer               |
 subarea         | text                  |
 road            | text                  |
 trial           | text                  |
 ibc             | text                  |
 subtrial        | text                  |
 country         | text                  |
 super_region    | text                  |
 area            | text                  |
 zone            | text                  |
Indexes: edw_object_day btree ("day"),
         ix_edw_object_omc_index btree (omc_index)
 
 

pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Firebird and PostgreSQL at the DB Corral.
Next
From: "Mike Hao"
Date:
Subject: Please remove me from the list, thanks