Re: oh dear ...

Lists: pgsql-hackers
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: oh dear ...
Date: 2003-11-14 23:15:20
Message-ID: 6296.1068851720@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

This worked in 7.3:

regression=# select '1999-jan-08'::date;
ERROR: date/time field value out of range: "1999-jan-08"
HINT: Perhaps you need a different "datestyle" setting.

Setting DateStyle to YMD doesn't help, and in any case I'd think that
this ought to be considered an unambiguous input format.

The variants
select 'jan-08-1999'::date;
select '08-jan-1999'::date;
both still work, so I think this is probably some small oversight in the
logic, but I haven't dug into it to find where.

Not sure if this qualifies as a must-fix-for-7.4 or not, but my vote
would be "yes" ...

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: oh dear ...
Date: 2003-11-15 00:32:12
Message-ID: 7824.1068856332@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I said:
> This worked in 7.3:
> regression=# select '1999-jan-08'::date;
> ERROR: date/time field value out of range: "1999-jan-08"
> HINT: Perhaps you need a different "datestyle" setting.

> Setting DateStyle to YMD doesn't help, and in any case I'd think that
> this ought to be considered an unambiguous input format.

This appears to be an oversight in the portions of the datetime code
that we recently changed to enforce DateStyle more tightly.
Specifically, DecodeNumber was rewritten without realizing that it was
invoked in a special way when a textual month name appears in the input.
DecodeDate actually makes two passes over the input, noting the textual
month name in the first pass, and then calling DecodeNumber on only the
numeric fields in the second pass. This means that when DecodeNumber is
called for the first time, the MONTH flag may already be set. The
rewrite mistakenly assumed that in this case we must be at the second
field of an MM-DD-YY-order input.

I propose the attached patch to fix the problem. It doesn't break any
regression tests, and it appears to fix the cases noted in its comment.

Opinions on whether to apply this to 7.4?

regards, tom lane

Attachment Content-Type Size
unknown_filename text/plain 1.1 KB

From: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: oh dear ...
Date: 2003-11-15 02:00:25
Message-ID: 20031114215957.W497@ganymede.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, 14 Nov 2003, Tom Lane wrote:

> I said:
> > This worked in 7.3:
> > regression=# select '1999-jan-08'::date;
> > ERROR: date/time field value out of range: "1999-jan-08"
> > HINT: Perhaps you need a different "datestyle" setting.
>
> > Setting DateStyle to YMD doesn't help, and in any case I'd think that
> > this ought to be considered an unambiguous input format.
>
> This appears to be an oversight in the portions of the datetime code
> that we recently changed to enforce DateStyle more tightly.
> Specifically, DecodeNumber was rewritten without realizing that it was
> invoked in a special way when a textual month name appears in the input.
> DecodeDate actually makes two passes over the input, noting the textual
> month name in the first pass, and then calling DecodeNumber on only the
> numeric fields in the second pass. This means that when DecodeNumber is
> called for the first time, the MONTH flag may already be set. The
> rewrite mistakenly assumed that in this case we must be at the second
> field of an MM-DD-YY-order input.
>
> I propose the attached patch to fix the problem. It doesn't break any
> regression tests, and it appears to fix the cases noted in its comment.
>
> Opinions on whether to apply this to 7.4?

based on "ought to be considered an unambiguous input format", I'd say
leave it for 7.4.1 ...


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: oh dear ...
Date: 2003-11-15 02:17:08
Message-ID: 200311150217.hAF2H8Q05264@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> I said:
> > This worked in 7.3:
> > regression=# select '1999-jan-08'::date;
> > ERROR: date/time field value out of range: "1999-jan-08"
> > HINT: Perhaps you need a different "datestyle" setting.
>
> > Setting DateStyle to YMD doesn't help, and in any case I'd think that
> > this ought to be considered an unambiguous input format.
>
> This appears to be an oversight in the portions of the datetime code
> that we recently changed to enforce DateStyle more tightly.
> Specifically, DecodeNumber was rewritten without realizing that it was
> invoked in a special way when a textual month name appears in the input.
> DecodeDate actually makes two passes over the input, noting the textual
> month name in the first pass, and then calling DecodeNumber on only the
> numeric fields in the second pass. This means that when DecodeNumber is
> called for the first time, the MONTH flag may already be set. The
> rewrite mistakenly assumed that in this case we must be at the second
> field of an MM-DD-YY-order input.
>
> I propose the attached patch to fix the problem. It doesn't break any
> regression tests, and it appears to fix the cases noted in its comment.
>
> Opinions on whether to apply this to 7.4?

I guess the question is whether we would fix this in a minor release,
and I think the answer it yes, so we can fix it now.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: oh dear ...
Date: 2003-11-15 02:39:02
Message-ID: 20031114223849.Y497@ganymede.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, 14 Nov 2003, Bruce Momjian wrote:

> Tom Lane wrote:
> > I said:
> > > This worked in 7.3:
> > > regression=# select '1999-jan-08'::date;
> > > ERROR: date/time field value out of range: "1999-jan-08"
> > > HINT: Perhaps you need a different "datestyle" setting.
> >
> > > Setting DateStyle to YMD doesn't help, and in any case I'd think that
> > > this ought to be considered an unambiguous input format.
> >
> > This appears to be an oversight in the portions of the datetime code
> > that we recently changed to enforce DateStyle more tightly.
> > Specifically, DecodeNumber was rewritten without realizing that it was
> > invoked in a special way when a textual month name appears in the input.
> > DecodeDate actually makes two passes over the input, noting the textual
> > month name in the first pass, and then calling DecodeNumber on only the
> > numeric fields in the second pass. This means that when DecodeNumber is
> > called for the first time, the MONTH flag may already be set. The
> > rewrite mistakenly assumed that in this case we must be at the second
> > field of an MM-DD-YY-order input.
> >
> > I propose the attached patch to fix the problem. It doesn't break any
> > regression tests, and it appears to fix the cases noted in its comment.
> >
> > Opinions on whether to apply this to 7.4?
>
> I guess the question is whether we would fix this in a minor release,
> and I think the answer it yes, so we can fix it now.

Ah, so we attempt to fix a bug that affects what appears to be a small %
of configurations with "quick testing" and with the greater possibility of
affecting a larger % of configurations ... instead of releasing what we
has been reported as being stable on the large % of configurations, and
fixing it for that small % of configuratiosn in a minor release?

Sounds to me like a decision design to benefit the few at the risk of the
many ... when documenting the known bug for those few would be safer ...


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: oh dear ...
Date: 2003-11-15 03:03:19
Message-ID: 3FB59777.1070107@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Marc G. Fournier wrote:

>On Fri, 14 Nov 2003, Bruce Momjian wrote:
>
>
>
>>Tom Lane wrote:
>>
>>
>>>I said:
>>>
>>>
>>>>This worked in 7.3:
>>>>regression=# select '1999-jan-08'::date;
>>>>ERROR: date/time field value out of range: "1999-jan-08"
>>>>HINT: Perhaps you need a different "datestyle" setting.
>>>>
>>>>
>>>>Setting DateStyle to YMD doesn't help, and in any case I'd think that
>>>>this ought to be considered an unambiguous input format.
>>>>
>>>>
>>>This appears to be an oversight in the portions of the datetime code
>>>that we recently changed to enforce DateStyle more tightly.
>>>Specifically, DecodeNumber was rewritten without realizing that it was
>>>invoked in a special way when a textual month name appears in the input.
>>>DecodeDate actually makes two passes over the input, noting the textual
>>>month name in the first pass, and then calling DecodeNumber on only the
>>>numeric fields in the second pass. This means that when DecodeNumber is
>>>called for the first time, the MONTH flag may already be set. The
>>>rewrite mistakenly assumed that in this case we must be at the second
>>>field of an MM-DD-YY-order input.
>>>
>>>I propose the attached patch to fix the problem. It doesn't break any
>>>regression tests, and it appears to fix the cases noted in its comment.
>>>
>>>Opinions on whether to apply this to 7.4?
>>>
>>>
>>I guess the question is whether we would fix this in a minor release,
>>and I think the answer it yes, so we can fix it now.
>>
>>
>
>Ah, so we attempt to fix a bug that affects what appears to be a small %
>of configurations with "quick testing" and with the greater possibility of
>affecting a larger % of configurations ... instead of releasing what we
>has been reported as being stable on the large % of configurations, and
>fixing it for that small % of configuratiosn in a minor release?
>
>Sounds to me like a decision design to benefit the few at the risk of the
>many ... when documenting the known bug for those few would be safer ...
>
>
>

I'm confused. My understanding from what Tom said is that it affects all
configurations.

cheers

andrew


From: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: oh dear ...
Date: 2003-11-15 03:42:46
Message-ID: 20031114234147.D497@ganymede.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, 14 Nov 2003, Andrew Dunstan wrote:

> I'm confused. My understanding from what Tom said is that it affects all
> configurations.

the stats collector problem, from what I've seen through this list,
affects Solaris, and only some Solaris configuration ..


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: oh dear ...
Date: 2003-11-15 04:16:36
Message-ID: 8932.1068869796@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Marc G. Fournier" <scrappy(at)postgresql(dot)org> writes:
> On Fri, 14 Nov 2003, Bruce Momjian wrote:
>> I guess the question is whether we would fix this in a minor release,
>> and I think the answer it yes, so we can fix it now.

> Ah, so we attempt to fix a bug that affects what appears to be a small %
> of configurations with "quick testing" and with the greater possibility of
> affecting a larger % of configurations ... instead of releasing what we
> has been reported as being stable on the large % of configurations, and
> fixing it for that small % of configuratiosn in a minor release?

Huh? The pgstat bug is a platform dependency, sure, but this datetime
bug is not platform-specific. I don't see that there's much commonality
in the criteria for whether to patch them.

My vote is to patch both --- I don't like shipping releases with known
bugs in them, when such bugs would have been patched with no discussion
just a week earlier. For sure we should triple-check the proposed
patches, but once that's done I don't see a reason to hold off.

The pgstat patch has already been checked to my satisfaction, but the
datetime patch needs more eyeballs on it; anyone out there have time to
look at it?

regards, tom lane


From: Joe Conway <mail(at)joeconway(dot)com>
To: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: oh dear ...
Date: 2003-11-15 04:21:52
Message-ID: 3FB5A9E0.6010206@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Marc G. Fournier wrote:
>
> On Fri, 14 Nov 2003, Andrew Dunstan wrote:
>>I'm confused. My understanding from what Tom said is that it affects all
>>configurations.
>
> the stats collector problem, from what I've seen through this list,
> affects Solaris, and only some Solaris configuration ..
>

But the issue at hand is this one:

Tom Lane wrote:
> This worked in 7.3:
>
> regression=# select '1999-jan-08'::date;
> ERROR: date/time field value out of range: "1999-jan-08"
> HINT: Perhaps you need a different "datestyle" setting.

Seems like this would affect everyone who uses this style of date in
their app. If it isn't a must fix for 7.4, we should plan 7.4.1 for a
fairly quick follow up.

Joe


From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: oh dear ...
Date: 2003-11-15 04:35:02
Message-ID: 3FB5ACF6.5030005@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> I propose the attached patch to fix the problem. It doesn't break any
> regression tests, and it appears to fix the cases noted in its comment.
>
> Opinions on whether to apply this to 7.4?

I think it should be fixed, since it could cause applications to break.
Shouldn't you also add a regression test to catch this in the future?

Chris


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: oh dear ...
Date: 2003-11-15 04:42:10
Message-ID: 9143.1068871330@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> Shouldn't you also add a regression test to catch this in the future?

Yes, I absolutely plan to stick some regression test additions into HEAD.
There's not a need for such changes in the 7.4 branch though. Right at
the moment what we need is a decision about whether to apply the code
change to 7.4 release ...

regards, tom lane


From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: oh dear ...
Date: 2003-11-15 04:51:15
Message-ID: 3FB5B0C3.5070102@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> The pgstat patch has already been checked to my satisfaction, but the
> datetime patch needs more eyeballs on it; anyone out there have time to
> look at it?

FWIW, it looks good to me, seems to work as intended, and passes all
existing regression tests.

Joe


From: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: oh dear ...
Date: 2003-11-15 05:01:55
Message-ID: 20031115010130.V4021@ganymede.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


My bad, confused two different issues in one thread :(

On Fri, 14 Nov 2003, Joe Conway wrote:

> Marc G. Fournier wrote:
> >
> > On Fri, 14 Nov 2003, Andrew Dunstan wrote:
> >>I'm confused. My understanding from what Tom said is that it affects all
> >>configurations.
> >
> > the stats collector problem, from what I've seen through this list,
> > affects Solaris, and only some Solaris configuration ..
> >
>
> But the issue at hand is this one:
>
> Tom Lane wrote:
> > This worked in 7.3:
> >
> > regression=# select '1999-jan-08'::date;
> > ERROR: date/time field value out of range: "1999-jan-08"
> > HINT: Perhaps you need a different "datestyle" setting.
>
> Seems like this would affect everyone who uses this style of date in
> their app. If it isn't a must fix for 7.4, we should plan 7.4.1 for a
> fairly quick follow up.
>
> Joe
>
>


From: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: oh dear ...
Date: 2003-11-15 05:02:41
Message-ID: 20031115010212.T4021@ganymede.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, 14 Nov 2003, Tom Lane wrote:

> Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> > Shouldn't you also add a regression test to catch this in the future?
>
> Yes, I absolutely plan to stick some regression test additions into HEAD.
> There's not a need for such changes in the 7.4 branch though. Right at
> the moment what we need is a decision about whether to apply the code
> change to 7.4 release ...

Go for it ...


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: oh dear ...
Date: 2003-11-15 17:30:46
Message-ID: 14988.1068917446@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Joe Conway <mail(at)joeconway(dot)com> writes:
> Tom Lane wrote:
>> The pgstat patch has already been checked to my satisfaction, but the
>> datetime patch needs more eyeballs on it; anyone out there have time to
>> look at it?

> FWIW, it looks good to me, seems to work as intended, and passes all
> existing regression tests.

I made up a more thorough regression test for date input formats, and
found that there were still some cases that were rejected :-(. Attached
is a more complete patch that handles all month-name cases, and
explicitly can not change the behavior when there's not a textual month
name. Documentation addition and regression test included.

I'd like some further review of this before I risk applying it to 7.4
though ... anyone have time today?

regards, tom lane

Attachment Content-Type Size
unknown_filename text/plain 24.0 KB

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joe Conway <mail(at)joeconway(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: oh dear ...
Date: 2003-11-16 01:50:14
Message-ID: 3FB6D7D6.2010306@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> I made up a more thorough regression test for date input formats, and
> found that there were still some cases that were rejected :-(. Attached
> is a more complete patch that handles all month-name cases, and
> explicitly can not change the behavior when there's not a textual month
> name. Documentation addition and regression test included.
>
> I'd like some further review of this before I risk applying it to 7.4
> though ... anyone have time today?

Hi Tom,

Everything passes for me on FreeBSD 4.8, latest CVS, "gmake check", with
your patch applied.

Chris


From: Joe Conway <mail(at)joeconway(dot)com>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: oh dear ...
Date: 2003-11-16 05:27:46
Message-ID: 3FB70AD2.5060509@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Christopher Kings-Lynne wrote:
>> I made up a more thorough regression test for date input formats, and
>> found that there were still some cases that were rejected :-(. Attached
>> is a more complete patch that handles all month-name cases, and
>> explicitly can not change the behavior when there's not a textual month
>> name. Documentation addition and regression test included.
>>
>> I'd like some further review of this before I risk applying it to 7.4
>> though ... anyone have time today?
>
> Everything passes for me on FreeBSD 4.8, latest CVS, "gmake check", with
> your patch applied.

Same here on RH 9.

Joe