Given (pseudocode)
CREATE TABLE kvstore (
k varchar primary key,
v varchar);
CREATE OR REPLACE FUNCTION store_key_value_pair(k varchar, v varchar)
returns boolean as $$
BEGIN
INSERT INTO kvstore (k, v)
SELECT :k, :v
WHERE NOT EXISTS (select 1 from kv
I have a collection of relationship rows of the form
Table: graph
key1 varchar
key2 varchar
A row of the form ('a','b') indicates that 'a' and 'b' are related.
The table contains many relationships between keys, forming several
disjoint sets. All relationships are bi-directional, and both
I'm working on an ETL system that is driven from Java/JDBC but is implemented
mostly as SQL queries against a PostgreSQL database.
An ETL "job" runs inside its own transaction and consists of a series of
queries that transform the data from staging tables to the destination tables.
If a fail