Re: odd behavior/possible bug (Was: Re: PG10 partitioning - odd behavior/possible bug)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: odd behavior/possible bug (Was: Re: PG10 partitioning - odd behavior/possible bug)
Date: 2017-09-03 22:34:26
Message-ID: 20986.1504478066@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joe Conway <mail(at)joeconway(dot)com> writes:
> Notice that tsr is not empty at all on the first loop, but on the second
> loop it is empty every second time the trigger fires.

I think the issue is that now() isn't changing within the transaction,
so when you construct "tstzrange(lower(OLD.tr), now(), '[)')" using an
old row whose "lower(OLD.tr)" is already "now()", you get an empty range.
Probably using '[]' bounds would avoid the oddness.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2017-09-04 00:01:14 Re: odd behavior/possible bug (Was: Re: PG10 partitioning - odd behavior/possible bug)
Previous Message Joe Conway 2017-09-03 22:22:17 odd behavior/possible bug (Was: Re: PG10 partitioning - odd behavior/possible bug)