| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | Li Japin <japinli(at)hotmail(dot)com> | 
| Cc: | Greg Stark <stark(at)mit(dot)edu>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: Duplicate function call on timestamp2tm | 
| Date: | 2019-12-12 15:13:17 | 
| Message-ID: | 5511.1576163597@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
I wrote:
> Li Japin <japinli(at)hotmail(dot)com> writes:
>> I find there is a duplicate function call on timestamp2tm in timestamptz_part and timestamp_part.
>> Is that necessary? I remove the latter one and it also works.
> Huh.  I do believe you're right.  Must be an ancient copy-and-paste
> mistake?
Ah, after looking in the git history, not quite that ancient:
this duplication dates to commit 258ee1b63, which moved these
switch cases from the "if (type == RESERV)" switches in the
same functions.  In the previous coding these function calls
were actually necessary, but here they're redundant.  I guess
that's just additional ammunition for Greg's point that the
keywords were misclassified ;-).
I see from the code coverage report that we're missing coverage
for these and some other paths in timestamp[tz]_part.  Think
I'll go add some more test cases while I'm at it.
Thanks again for the report!
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2019-12-12 15:14:03 | Re: Wrong assert in TransactionGroupUpdateXidStatus | 
| Previous Message | David Fetter | 2019-12-12 15:12:15 | Re: Let people set host(no)ssl settings from initdb |