Re: overriding current_timestamp
От | David E. Wheeler |
---|---|
Тема | Re: overriding current_timestamp |
Дата | |
Msg-id | C9C9169B-2464-4B6A-82C8-CE36B2C3337E@justatheory.com обсуждение исходный текст |
Ответ на | overriding current_timestamp (Peter Eisentraut <peter_e@gmx.net>) |
Ответы |
Re: overriding current_timestamp
Re: overriding current_timestamp |
Список | pgsql-hackers |
On Feb 23, 2012, at 3:08 AM, Peter Eisentraut wrote: > 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. I create a "mock" schema, add the function to it, and then put it in the search_path ahead of pg_catalog. See the examplestarting at slide 48 on http://www.slideshare.net/justatheory/pgtap-best-practices. Best, David
В списке pgsql-hackers по дате отправления: