Search Postgresql Archives

Re: spi/timetravel: unique constraint violation on UPDATE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



postgresql@xxxxxxxxxxxxxxxxxx writes:
> I'm having a problem with the timetravel extension. Following simple schema:
> ...
> What am I doing wrong here? According to the function comment in
> timetravel.c it should:
> a) set last-version row to NEW data; valid_from=now()
> b) insert a new row with OLD data; valid_to=now() - at this point the
> old valid_from is already supposed to be updated.

I don't see anywhere in that comment that says "the old valid_from is
already supposed to be updated".  Given that the INSERT of the cloned row
happens during the BEFORE UPDATE trigger, it would take a lot of magic
for things to happen that way ;-).

Perhaps you could make your PK be on (id, valid_from, valid_to).

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux