mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
date, interval and timestamp data should be quoted.
This commit is contained in:
@ -17,6 +17,8 @@ main()
|
||||
Date date2;
|
||||
int mdy[3] = { 4, 19, 1998 };
|
||||
char *fmt, *out, *in;
|
||||
char *d1 = "Mon Jan 17 1966";
|
||||
char *t1 = "2000-7-12 17:34:29";
|
||||
|
||||
FILE *dbgs;
|
||||
|
||||
@ -25,8 +27,12 @@ main()
|
||||
exec sql whenever sqlerror do sqlprint();
|
||||
exec sql connect to mm;
|
||||
exec sql create table date_test (d date, ts timestamp, iv interval);
|
||||
exec sql set datestyle to iso;
|
||||
|
||||
exec sql insert into date_test(d, ts, iv) values ('Mon Jan 17 1966', '2000-7-12 17:34:29', now()-'Mon Jan 17 1966');
|
||||
date1 = PGTYPESdate_from_asc(d1, NULL);
|
||||
ts1 = PGTYPEStimestamp_from_asc(t1, NULL);
|
||||
|
||||
exec sql insert into date_test(d, ts, iv) values (:date1, :ts1, now()-'Mon Jan 17 1966');
|
||||
|
||||
exec sql select * into :date1, :ts1 , :iv1 from date_test;
|
||||
|
||||
@ -38,7 +44,7 @@ main()
|
||||
|
||||
text = PGTYPESinterval_to_asc(&iv1);
|
||||
printf ("interval: %s\n", text);
|
||||
|
||||
|
||||
PGTYPESdate_mdyjul(mdy, &date2);
|
||||
printf("m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
|
||||
/* reset */
|
||||
|
Reference in New Issue
Block a user