Re: Struggling with EXCLUDE USING gist

Поиск
Список
Период
Сортировка
От Laura Smith
Тема Re: Struggling with EXCLUDE USING gist
Дата
Msg-id ci4WFRevLMkhsuc5BwISmC6j9oT_29nAe1LyGqAGO_RIl7SlhJZycTCp2mzaCttrtVNGyDatlCeKAG4aSk5P06DBi3zFms-LwaDbyIlkvZY=@protonmail.ch
обсуждение исходный текст
Ответ на Re: Struggling with EXCLUDE USING gist  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Struggling with EXCLUDE USING gist  (Joe Conway <mail@joeconway.com>)
Список pgsql-general
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, 4 June 2021 18:07, Adrian Klaver <adrian.klaver@aklaver.com> wrote:

> On 6/4/21 9:47 AM, Laura Smith wrote:
>
> > All the examples I've seen around the internet make this sound so easy.
> > But I seem to be missing some important step because all I'm getting are messages such as "DETAIL: Key (t_val,
t_version)=(def,[-infinity,infinity)) conflicts with existing key (t_val, t_version)=(def, [-infinity,"2021-06-04
16:56:08.008122+01"))."
>
> That would be correct:
>
> select '[-infinity,infinity)'::tstzrange && '[-infinity,"2021-06-04
> 16:56:08.008122+01")'::tstzrange;
> ?column?
>
>
-----------------------------------------------------------------------------------------------------------------------------------------
>
> t
>
> The ranges overlap so they fail the exclusion constraint.
>


So it seems we are agreed (me via error message, you via example) that a transaction (function script) that updates the
"old"row to fixed timestamp before inserting a "new" row will not have the desired result. 

What is the solution then ?  I need to keep historical versions but at the same time I need a "current" version.  If I
amnot able to use "infinity" as bounds for "current" version then clearly I'm wasting my time trying to use EXCLUDE AS
forversion tracking because clearly using fixed timestamps instead of "infinity" for tstzrange would be a hacky fix
thatwill be fragile and prone to breakage. 





В списке pgsql-general по дате отправления:

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: Struggling with EXCLUDE USING gist
Следующее
От: Laura Smith
Дата:
Сообщение: Re: Struggling with EXCLUDE USING gist