From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | 甄明洋 <zhenmingyang(at)yeah(dot)net>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: setting the timezone parameter with space cause diff result |
Date: | 2021-06-09 03:20:50 |
Message-ID: | 1264125.1623208850@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Tuesday, June 8, 2021, 甄明洋 <zhenmingyang(at)yeah(dot)net> wrote:
>> Here is an example, which seems to be a problem of parsing, if format
>> string with FF and TZH:TZM, but the datetime string without fractional
>> seconds will cause parsing misalignment,
> Yes, with a template language this complex it is possible that invalid
> input will mis-parse instead of provoking an error. Use regexes if you
> need to validate the input format - all the parser should really be relied
> upon to do is take a valid input and convert it.
TBH, if we simply took away to_timestamp(), most users would be better off.
I do not think I've ever seen a single complaint about it that didn't
involve an input format that timestamp_in doesn't handle as well or
better.
to_timestamp with a normal-looking format is an antipattern. Just cast
the string to timestamp(tz), instead. Consider to_timestamp *only*
after you find that doesn't work.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2021-06-09 03:33:17 | Re: logical decoding bug: segfault in ReorderBufferToastReplace() |
Previous Message | David G. Johnston | 2021-06-09 02:46:18 | Re: setting the timezone parameter with space cause diff result |