From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Stacy White <harsh(at)computer(dot)org>, <pgsql-bugs(at)postgresql(dot)org>, Aaron Harsh <ajh(at)rentrak(dot)com> |
Subject: | Re: to_timestamp not stable if date string shorter than |
Date: | 2003-09-03 02:03:56 |
Message-ID: | 20030902185653.Q57128-100000@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-patches |
On Tue, 2 Sep 2003, Stephan Szabo wrote:
> On Tue, 2 Sep 2003, Stephan Szabo wrote:
>
> >
> > On Tue, 2 Sep 2003, Tom Lane wrote:
> >
> > > "Stacy White" <harsh(at)computer(dot)org> writes:
> > > > to_timestamp appears to pick up the time-of-day from the previous call's
> > > > return value if a date string has no time component. For example:
> > >
> > > Weird. I do not see that here, on either 7.3.4 or current sources.
> > > Can anyone else reproduce it?
> > >
>
> >From my beta1 machine it looks to me that to_timestamp is willing to read
> off the end of the input string sometimes:
>
> Breakpoint 3, DCH_processor (node=0x82d8da0, inout=0x8347860 "2003-06",
> flag=2, data=0xbfffd080) at formatting.c:1302
> 1302 len = n->key->action(n->key->id, s,
> n->suffix, flag, n, data);
> (gdb) print s
> $3 = 0x8347860 "2003-06"
> (gdb) cont
> Continuing.
>
> Breakpoint 3, DCH_processor (node=0x82d8da0, inout=0x8347860 "2003-06",
> flag=2, data=0xbfffd080) at formatting.c:1302
> 1302 len = n->key->action(n->key->id, s,
> n->suffix, flag, n, data);
> (gdb) print s
> $4 = 0x8347865 "06"
> (gdb) cont
> Continuing.
>
>
> ** All of a sudden at this following breakpoint s has more text in it and
> is past the \0 which would be at 0x8347867 AFAICS. ***
>
> Breakpoint 3, DCH_processor (node=0x82d8da0, inout=0x8347860 "2003-06",
> flag=2, data=0xbfffd080) at formatting.c:1302
> 1302 len = n->key->action(n->key->id, s,
> n->suffix, flag, n, data);
> (gdb) print s
> $5 = 0x8347868 "04 02:02:02"
> (gdb) cont
> Continuing.
>
> Breakpoint 3, DCH_processor (node=0x82d8da0, inout=0x8347860 "2003-06",
> flag=2, data=0xbfffd080) at formatting.c:1302
> 1302 len = n->key->action(n->key->id, s,
> n->suffix, flag, n, data);
> (gdb) print s
> $6 = 0x834786b "02:02:02"
> (gdb)
>
> ---
> I don't entirely understand all of what that code is doing, but I think
> there's something in there that needs to get fixed.
Replying to myself again:
In DCH_processor (formatting.c), it doesn't seem to stop if it's in the
middle of processing nodes but runs off the inout string, should the for
loop be something like:
for (n=node,s=inout;n->type!=NODE_TYPE_END && *s!='\0';++n,++s) {
and get rid of the ++s at the bottom of the loop for safety?
From | Date | Subject | |
---|---|---|---|
Next Message | Guy Thornley | 2003-09-03 03:43:18 | Re: Vacuum I/O throttling] |
Previous Message | Stephan Szabo | 2003-09-02 23:39:26 | Re: to_timestamp not stable if date string shorter than |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-09-03 04:15:47 | Re: to_timestamp not stable if date string shorter than |
Previous Message | Böjthe Zoltán | 2003-09-02 13:11:19 | Re: timetravel.c |