Re: function for setting/getting same timestamp during whole transaction
От | Miroslav Šimulčík |
---|---|
Тема | Re: function for setting/getting same timestamp during whole transaction |
Дата | |
Msg-id | CAHRNM69nMnxxyoQ6C99hh6vJuepAtqXwARomN=nVb6Pmvdyc=g@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: function for setting/getting same timestamp during whole transaction (Pavel Stehule <pavel.stehule@gmail.com>) |
Список | pgsql-hackers |
probably you can use a little bit cheaper session variables
I rejected session variables, because they don't get cleared at the end of transaction if somebody set value on session level. So I can't decide if new transaction started.
this is good (variable is cleared at the end of transaction):
begin;
set local test.value to 123;
show test.value;
test.value
------------
123
commit;
show test.value; --cleared => transaction ended
test.haha
-----------
but this is bad:
begin;
set local test.value to 123;
show test.value;
test.value
------------
123
set test.value to 456;
commit;
show test.value; --not cleared
test.haha
-----------
456
test to system tables is slower then trapping error - just try to read
from tmp and when a read fails, then create table
Ok I will try reading from temp table directly with error trapping and compare times.
probably C trigger can be very effective, possible to use this
technique - http://postgres.cz/wiki/Funkce_rownum%28%29 (sorry, it is
in Czech language)
I'm from Slovakia so I don't have problem with czech language, but I'm not sure how to do it in C function without using temp table, because I need to clear variable at the end/start of transaction. Any hints?
Miro
В списке pgsql-hackers по дате отправления: