Re: Infinite Interval

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joseph Koshakow <koshy44(at)gmail(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, "Gregory Stark (as CFM)" <stark(dot)cfm(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Infinite Interval
Date: 2023-03-19 21:13:01
Message-ID: 796045.1679260381@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joseph Koshakow <koshy44(at)gmail(dot)com> writes:
> I must have been doing something wrong because I tried again today and
> it worked fine. However, I go get a lot of changes like the following:

> - if TIMESTAMP_IS_NOBEGIN(dt2)
> - ereport(ERROR,
> -
> (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
> - errmsg("timestamp out of
> range")));
> + if TIMESTAMP_IS_NOBEGIN
> + (dt2)
> + ereport(ERROR,
> +
> (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
> + errmsg("timestamp out of
> range")));

> Should I keep these pgindent changes or keep it the way I have it?

Did you actually write "if TIMESTAMP_IS_NOBEGIN(dt2)" and not
"if (TIMESTAMP_IS_NOBEGIN(dt2))"? If the former, I'm not surprised
that pgindent gets confused. The parentheses are required by the
C standard. Your code might accidentally work because the macro
has parentheses internally, but call sites have no business
knowing that. For example, it would be completely legit to change
TIMESTAMP_IS_NOBEGIN to be a plain function, and then this would be
syntactically incorrect.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joseph Koshakow 2023-03-19 21:46:02 Re: Infinite Interval
Previous Message Tom Lane 2023-03-19 20:56:14 Re: Commitfest 2023-03 starting tomorrow!