update entire table (with PostGreSQL alone)? - Mailing list pgsql-general

From yruhn
Subject update entire table (with PostGreSQL alone)?
Date
Msg-id 200308221048.AA48889986@xdh.nl
Whole thread Raw
Responses Re: update entire table (with PostGreSQL alone)?  (Bruno Wolff III <bruno@wolff.to>)
Re: update entire table (with PostGreSQL alone)?  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-general
Dear anyone,

I wish to update an entire table with just using (PostGre)SQL (=preferably without resorting to C, Python or so). Can
I?If so how?  

For example, I want to update/replace table:

 a | b | c
---+---+---
 1 | 2 | 3
 4 | 5 | 6
 7 | 8 | 9

with table:

 a | b | c
---+---+---
 1 | 2 | 2
 4 | 5 | 6
 9 | 0 | 0

So, I wish to:
1- update every data point in the table (based on the UNIQUE column 'a' (=PRIMARY KEY)), and if this value of a is not
present(such as for instance value 9: 9,0,0),I wish to; 
2- insert a new row with data points
3- and I want to delete old rows that are not used present in the new table (such as row 7 : 7,8,9)

How can I update an entire table with just using (PestGre)SQL?

Lots of thanks for any help anyone can give me,

Wiliam Knobbel, PhD-Student


pgsql-general by date:

Previous
From: Michal Adamczakk
Date:
Subject: mysql's last_insert_id
Next
From: sharvari N
Date:
Subject: a problem