Skip site navigation (1) Skip section navigation (2)

overriding current_timestamp

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: overriding current_timestamp
Date: 2012-02-23 11:08:51
Message-ID: 1329995331.6474.14.camel@vanquo.pezone.net (view raw or flat)
Thread:
Lists: pgsql-hackers
For (unit) testing, I have often had the need to override the current
timestamp in the database system.  For example, a column default,
function, or views would make use of the current timestamp in some way,
and to test the behavior, it's sometimes useful to tweak the current
timestamp.

What might be a good way to do that?

Just overwrite xactStartTimestamp?  Is that safe?  If it weren't static,
a user-loaded function could do it.

Overwrite pg_catalog.now() in the test database?

Other ideas?

Some semi-official support for this sort of thing would be good.



Responses

pgsql-hackers by date

Next:From: Peter GeogheganDate: 2012-02-23 11:09:18
Subject: Re: pg_stat_statements normalization: re-review
Previous:From: Kyotaro HORIGUCHIDate: 2012-02-23 10:14:03
Subject: Re: Speed dblink using alternate libpq tuple storage

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group