pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: doc: improve PG 12 to_timestamp()/to_date() wording
5+ messages / 3 participants
[nested] [flat]
* Re: doc: improve PG 12 to_timestamp()/to_date() wording
@ 2019-04-30 18:36 Justin Pryzby <pryzby@telsasoft.com>
0 siblings, 1 reply; 5+ messages in thread
From: Justin Pryzby @ 2019-04-30 18:36 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: pgsql-hackers@lists.postgresql.org
Hi Bruce
I saw this commit;
commit ad23adc5a169b114f9ff325932cbf2ce1c5e69c1
|Author: Bruce Momjian <bruce@momjian.us>
|Date: Tue Apr 30 14:06:57 2019 -0400
|
| doc: improve PG 12 to_timestamp()/to_date() wording
which cleans up language added at cf984672.
Can I suggest this additional change, which is updated and extracted from my
larger set of documentation fixes.
Justin
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 96fafdd..b420585 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -6400,20 +6400,20 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
</para>
<para>
If <literal>FX</literal> is specified, a separator in the template string
- matches exactly one character in input string. Notice we don't insist the
- input string character be the same as the template string separator.
+ matches exactly one character in the input string. But note that the
+ input string character is not required to be the same as the separator from the template string.
For example, <literal>to_timestamp('2000/JUN', 'FXYYYY MON')</literal>
works, but <literal>to_timestamp('2000/JUN', 'FXYYYY MON')</literal>
- returns an error because the second template string space is consumed
- by the letter <literal>J</literal> in the input string.
+ returns an error because the second space in the template string consumes
+ the letter <literal>M</literal> from the input string.
</para>
</listitem>
<listitem>
<para>
A <literal>TZH</literal> template pattern can match a signed number.
- Without the <literal>FX</literal> option, it can lead to ambiguity in
- interpretation of the minus sign, which can also be interpreted as a separator.
+ Without the <literal>FX</literal> option, minus signs may be ambiguous,
+ and could be interpreted as a separator.
This ambiguity is resolved as follows: If the number of separators before
<literal>TZH</literal> in the template string is less than the number of
separators before the minus sign in the input string, the minus sign
Attachments:
[text/x-diff] v3-0001-Clean-up-language-in-cf984672-Improve-behavior-of.patch (2.1K, ../../20190430183636.GA8175@telsasoft.com/2-v3-0001-Clean-up-language-in-cf984672-Improve-behavior-of.patch)
download | inline diff:
From 0d304935aa5b83e56127b5a63aa3d180b4c42e16 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sat, 30 Mar 2019 03:42:35 -0500
Subject: [PATCH v3] Clean up language in cf984672: Improve behavior of
to_timestamp()/to_date() functions
---
doc/src/sgml/func.sgml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 96fafdd..b420585 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -6400,20 +6400,20 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
</para>
<para>
If <literal>FX</literal> is specified, a separator in the template string
- matches exactly one character in input string. Notice we don't insist the
- input string character be the same as the template string separator.
+ matches exactly one character in the input string. But note that the
+ input string character is not required to be the same as the separator from the template string.
For example, <literal>to_timestamp('2000/JUN', 'FXYYYY MON')</literal>
works, but <literal>to_timestamp('2000/JUN', 'FXYYYY MON')</literal>
- returns an error because the second template string space is consumed
- by the letter <literal>J</literal> in the input string.
+ returns an error because the second space in the template string consumes
+ the letter <literal>M</literal> from the input string.
</para>
</listitem>
<listitem>
<para>
A <literal>TZH</literal> template pattern can match a signed number.
- Without the <literal>FX</literal> option, it can lead to ambiguity in
- interpretation of the minus sign, which can also be interpreted as a separator.
+ Without the <literal>FX</literal> option, minus signs may be ambiguous,
+ and could be interpreted as a separator.
This ambiguity is resolved as follows: If the number of separators before
<literal>TZH</literal> in the template string is less than the number of
separators before the minus sign in the input string, the minus sign
--
2.7.4
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: doc: improve PG 12 to_timestamp()/to_date() wording
@ 2019-04-30 18:48 Alexander Korotkov <a.korotkov@postgrespro.ru>
parent: Justin Pryzby <pryzby@telsasoft.com>
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Korotkov @ 2019-04-30 18:48 UTC (permalink / raw)
To: Justin Pryzby <pryzby@telsasoft.com>; +Cc: Bruce Momjian <bruce@momjian.us>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Hi!
I'd like to add couple of comments from my side.
On Tue, Apr 30, 2019 at 9:36 PM Justin Pryzby <pryzby@telsasoft.com> wrote:
> I saw this commit;
> commit ad23adc5a169b114f9ff325932cbf2ce1c5e69c1
> |Author: Bruce Momjian <bruce@momjian.us>
> |Date: Tue Apr 30 14:06:57 2019 -0400
> |
> | doc: improve PG 12 to_timestamp()/to_date() wording
>
> which cleans up language added at cf984672.
>
> Can I suggest this additional change, which is updated and extracted from my
> larger set of documentation fixes.
>
> Justin
>
> diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
> index 96fafdd..b420585 100644
> --- a/doc/src/sgml/func.sgml
> +++ b/doc/src/sgml/func.sgml
> @@ -6400,20 +6400,20 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
> </para>
> <para>
> If <literal>FX</literal> is specified, a separator in the template string
> - matches exactly one character in input string. Notice we don't insist the
> - input string character be the same as the template string separator.
> + matches exactly one character in the input string. But note that the
> + input string character is not required to be the same as the separator from the template string.
Looks good for me.
> For example, <literal>to_timestamp('2000/JUN', 'FXYYYY MON')</literal>
> works, but <literal>to_timestamp('2000/JUN', 'FXYYYY MON')</literal>
> - returns an error because the second template string space is consumed
> - by the letter <literal>J</literal> in the input string.
> + returns an error because the second space in the template string consumes
> + the letter <literal>M</literal> from the input string.
> </para>
> </listitem>
Why <literal>M</literal>? There is no letter "M" is input string.
The issue here is that we already consumed "J" from "JUN" and trying
to match "UN" to "MON". So, I think we should live
<literal>J</literal> here. The rest of this change looks good.
> <listitem>
> <para>
> A <literal>TZH</literal> template pattern can match a signed number.
> - Without the <literal>FX</literal> option, it can lead to ambiguity in
> - interpretation of the minus sign, which can also be interpreted as a separator.
> + Without the <literal>FX</literal> option, minus signs may be ambiguous,
> + and could be interpreted as a separator.
> This ambiguity is resolved as follows: If the number of separators before
> <literal>TZH</literal> in the template string is less than the number of
> separators before the minus sign in the input string, the minus sign
Looks good for me.
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: doc: improve PG 12 to_timestamp()/to_date() wording
@ 2019-05-01 00:14 Justin Pryzby <pryzby@telsasoft.com>
parent: Alexander Korotkov <a.korotkov@postgrespro.ru>
0 siblings, 1 reply; 5+ messages in thread
From: Justin Pryzby @ 2019-05-01 00:14 UTC (permalink / raw)
To: Alexander Korotkov <a.korotkov@postgrespro.ru>; +Cc: Bruce Momjian <bruce@momjian.us>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
On Tue, Apr 30, 2019 at 09:48:14PM +0300, Alexander Korotkov wrote:
> I'd like to add couple of comments from my side.
> > - returns an error because the second template string space is consumed
> > - by the letter <literal>J</literal> in the input string.
> > + returns an error because the second space in the template string consumes
> > + the letter <literal>M</literal> from the input string.
>
> Why <literal>M</literal>? There is no letter "M" is input string.
> The issue here is that we already consumed "J" from "JUN" and trying
> to match "UN" to "MON". So, I think we should live
> <literal>J</literal> here. The rest of this change looks good.
Seems like I confused myself while resolving rebase conflict.
Thanks for checking.
Justin
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: doc: improve PG 12 to_timestamp()/to_date() wording
@ 2019-07-06 20:24 Justin Pryzby <pryzby@telsasoft.com>
parent: Justin Pryzby <pryzby@telsasoft.com>
0 siblings, 1 reply; 5+ messages in thread
From: Justin Pryzby @ 2019-07-06 20:24 UTC (permalink / raw)
To: Alexander Korotkov <a.korotkov@postgrespro.ru>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
On Tue, Apr 30, 2019 at 07:14:04PM -0500, Justin Pryzby wrote:
> On Tue, Apr 30, 2019 at 09:48:14PM +0300, Alexander Korotkov wrote:
> > I'd like to add couple of comments from my side.
>
> > > - returns an error because the second template string space is consumed
> > > - by the letter <literal>J</literal> in the input string.
> > > + returns an error because the second space in the template string consumes
> > > + the letter <literal>M</literal> from the input string.
> >
> > Why <literal>M</literal>? There is no letter "M" is input string.
> > The issue here is that we already consumed "J" from "JUN" and trying
> > to match "UN" to "MON". So, I think we should live
> > <literal>J</literal> here. The rest of this change looks good.
>
> Seems like I confused myself while resolving rebase conflict.
>
> Thanks for checking.
Find attached updated patch, which seems to still be needed.
This was subsumed and now extracted from a larger patch, from which Michael at
one point applied a few hunks.
I have some minor updates based on review from Andres, but there didn't seem to
be much interest so I haven't pursued it.
https://www.postgresql.org/message-id/20190520182001.GA25675%40telsasoft.com
Justin
Attachments:
[text/x-diff] v3-0008-Clean-up-language-in-cf984672-Improve-behavior-of.patch (2.1K, ../../20190706202425.GA16933@telsasoft.com/2-v3-0008-Clean-up-language-in-cf984672-Improve-behavior-of.patch)
download | inline diff:
From 2ca5c2f2f8ad8bb8a681aea7ca78131f1f99d756 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sat, 30 Mar 2019 03:42:35 -0500
Subject: [PATCH v3 08/12] Clean up language in cf984672: Improve behavior of
to_timestamp()/to_date() functions
---
doc/src/sgml/func.sgml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index d425731..c5f1828 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -6426,20 +6426,20 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
</para>
<para>
If <literal>FX</literal> is specified, a separator in the template string
- matches exactly one character in input string. Notice we don't insist the
- input string character be the same as the template string separator.
+ matches exactly one character in the input string. But note that the
+ input string character is not required to be the same as the separator from the template string.
For example, <literal>to_timestamp('2000/JUN', 'FXYYYY MON')</literal>
works, but <literal>to_timestamp('2000/JUN', 'FXYYYY MON')</literal>
- returns an error because the second template string space is consumed
- by the letter <literal>J</literal> in the input string.
+ returns an error because the second space in the template string consumes
+ the letter <literal>J</literal> from the input string.
</para>
</listitem>
<listitem>
<para>
A <literal>TZH</literal> template pattern can match a signed number.
- Without the <literal>FX</literal> option, it can lead to ambiguity in
- interpretation of the minus sign, which can also be interpreted as a separator.
+ Without the <literal>FX</literal> option, minus signs may be ambiguous,
+ and could be interpreted as a separator.
This ambiguity is resolved as follows: If the number of separators before
<literal>TZH</literal> in the template string is less than the number of
separators before the minus sign in the input string, the minus sign
--
2.7.4
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: doc: improve PG 12 to_timestamp()/to_date() wording
@ 2019-07-09 03:04 Bruce Momjian <bruce@momjian.us>
parent: Justin Pryzby <pryzby@telsasoft.com>
0 siblings, 0 replies; 5+ messages in thread
From: Bruce Momjian @ 2019-07-09 03:04 UTC (permalink / raw)
To: Justin Pryzby <pryzby@telsasoft.com>; +Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
On Sat, Jul 6, 2019 at 03:24:25PM -0500, Justin Pryzby wrote:
> On Tue, Apr 30, 2019 at 07:14:04PM -0500, Justin Pryzby wrote:
> > On Tue, Apr 30, 2019 at 09:48:14PM +0300, Alexander Korotkov wrote:
> > > I'd like to add couple of comments from my side.
> >
> > > > - returns an error because the second template string space is consumed
> > > > - by the letter <literal>J</literal> in the input string.
> > > > + returns an error because the second space in the template string consumes
> > > > + the letter <literal>M</literal> from the input string.
> > >
> > > Why <literal>M</literal>? There is no letter "M" is input string.
> > > The issue here is that we already consumed "J" from "JUN" and trying
> > > to match "UN" to "MON". So, I think we should live
> > > <literal>J</literal> here. The rest of this change looks good.
> >
> > Seems like I confused myself while resolving rebase conflict.
> >
> > Thanks for checking.
>
> Find attached updated patch, which seems to still be needed.
>
> This was subsumed and now extracted from a larger patch, from which Michael at
> one point applied a few hunks.
> I have some minor updates based on review from Andres, but there didn't seem to
> be much interest so I haven't pursued it.
> https://www.postgresql.org/message-id/20190520182001.GA25675%40telsasoft.com
Patch applied back through PG 12. Thanks.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2019-07-09 03:04 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30 18:36 Re: doc: improve PG 12 to_timestamp()/to_date() wording Justin Pryzby <pryzby@telsasoft.com>
2019-04-30 18:48 ` Re: doc: improve PG 12 to_timestamp()/to_date() wording Alexander Korotkov <a.korotkov@postgrespro.ru>
2019-05-01 00:14 ` Re: doc: improve PG 12 to_timestamp()/to_date() wording Justin Pryzby <pryzby@telsasoft.com>
2019-07-06 20:24 ` Re: doc: improve PG 12 to_timestamp()/to_date() wording Justin Pryzby <pryzby@telsasoft.com>
2019-07-09 03:04 ` Re: doc: improve PG 12 to_timestamp()/to_date() wording Bruce Momjian <bruce@momjian.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox