SELECT ... FOR UPDATE

From: "Guillaume Houssay" <ghoussay(at)noos(dot)fr>
To: <pgsql-general(at)postgresql(dot)org>
Subject: SELECT ... FOR UPDATE
Date: 2003-12-21 01:14:56
Message-ID: 004c01c3c75f$e59343c0$8600a8c0@camille
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-12-21 01:28:36 Re: [GENERAL] Backwards index scan
Previous Message Jeff Davis 2003-12-21 00:14:51 Re: Firebird and PostgreSQL at the DB Corral.