Re: AS OF queries - Mailing list pgsql-hackers

From legrand legrand
Subject Re: AS OF queries
Date
Msg-id 1515012543406-0.post@n3.nabble.com
Whole thread Raw
In response to Re: AS OF queries  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: AS OF queries
List pgsql-hackers
Maybe that a simple check of the asof_timestamp value like:

asof_timestamp >= now() - time_travel_period
AND 
asof_timestamp >= latest_table_ddl

would permit to raise a warning or an error message saying that query result
can not be garanteed with this asof_timestamp value.


latest_table_ddl being found with

SELECT greatest( max(pg_xact_commit_timestamp( rel.xmin )),
max(pg_xact_commit_timestamp( att.xmin ))) as latest_table_ddl 
FROM      pg_catalog.pg_attribute att     
INNER JOIN pg_catalog.pg_class rel     
ON att.attrelid = rel.oid WHERE    rel.relname = '<asof_tablename>' and
rel.relowner= ...

(tested with add/alter/drop column and drop/create/truncate table)

Regards
PAscal



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html


pgsql-hackers by date:

Previous
From: Remi Colinet
Date:
Subject: Re: [Patch] Make block and file size for WAL and relations defined atcluster creation
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Proposal: Local indexes for partitioned table