From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | paul tilles <Paul(dot)Tilles(at)noaa(dot)gov> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: ecpg-timestamp- interval problem V8.2.x |
Date: | 2008-04-08 15:02:03 |
Message-ID: | 1258.1207666923@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
paul tilles <Paul(dot)Tilles(at)noaa(dot)gov> writes:
> {
> timestamp dt1st, dt2nd;
> interval *int_day, *int_pt;
> char timebeg[40];
> char timeend[40];
> int rc;
> strcpy(timebeg,"2008-04-01");
> strcpy(timeend,"2008-04-05");
> printf("timebeg: %s\n", timebeg);
> printf("timeend: %s\n", timeend);
> dt1st=PGTYPEStimestamp_from_asc(timebeg,NULL);
> dt2nd=PGTYPEStimestamp_from_asc(timeend,NULL);
> int_day=PGTYPESinterval_from_asc("02 01:02:03", NULL);
> printf("int_day : %s\n", PGTYPESinterval_to_asc(int_day));
> rc=PGTYPEStimestamp_sub(&dt2nd, &dt1st, int_pt);
> printf("rc, date2 - date1 = %d, %s\n", rc, PGTYPESinterval_to_asc(int_pt));
> exit(0);
> }
Surely this code is using "int_pt" without having first assigned to it?
IOW the interval result is being stored at some unpredictable place that
could get clobbered during the printf.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2008-04-08 15:08:35 | Re: plperlu and perl 5.10 |
Previous Message | imageguy | 2008-04-08 14:58:15 | Number or parameters for functions - limited to 32 ? |