Re: using possibly null timestamptz columns
| От | Tom Lane |
|---|---|
| Тема | Re: using possibly null timestamptz columns |
| Дата | |
| Msg-id | 5497.1475154922@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: using possibly null timestamptz columns (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: using possibly null timestamptz columns
|
| Список | pgsql-sql |
I wrote:
> You could try constructing a GIST or SPGIST index on the ranges
> tstzrange(s, e), where you'd have to do something to convert null
> endpoints to infinities, and then probing with WHERE rangeexpr @> now().
Or actually, it looks like tstzrange() already does the right thing:
regression=# select tstzrange(now(), null); tstzrange
-----------------------------------["2016-09-29 09:12:14.79429-04",)
(1 row)
regression=# select tstzrange(null, now()); tstzrange
------------------------------------(,"2016-09-29 09:12:33.632327-04")
(1 row)
So this just reduces to WHERE tstzrange(s, e) @> now().
regards, tom lane
В списке pgsql-sql по дате отправления: