@@ -70,6 +70,7 @@ main(void)
7070
7171
7272
73+
7374
7475#line 51 "dt_test2.pgc"
7576 date date1 ;
@@ -82,8 +83,11 @@ main(void)
8283
8384#line 54 "dt_test2.pgc"
8485 interval * i1 ;
85- /* exec sql end declare section */
86+
8687#line 55 "dt_test2.pgc"
88+ date * dc ;
89+ /* exec sql end declare section */
90+ #line 56 "dt_test2.pgc"
8791
8892
8993 int i , j ;
@@ -98,9 +102,12 @@ main(void)
98102 free (text );
99103
100104 date1 = PGTYPESdate_from_timestamp (ts1 );
101- text = PGTYPESdate_to_asc (date1 );
105+ dc = PGTYPESdate_new ();
106+ * dc = date1 ;
107+ text = PGTYPESdate_to_asc (* dc );
102108 printf ("Date of timestamp: %s\n" , text );
103109 free (text );
110+ PGTYPESdate_free (dc );
104111
105112 for (i = 0 ; dates [i ]; i ++ )
106113 {
@@ -139,6 +146,7 @@ main(void)
139146
140147 for (i = 0 ; intervals [i ]; i ++ )
141148 {
149+ interval * ic ;
142150 i1 = PGTYPESinterval_from_asc (intervals [i ], & endptr );
143151 if (* endptr )
144152 printf ("endptr set to %s\n" , endptr );
@@ -153,6 +161,13 @@ main(void)
153161 text = PGTYPESinterval_to_asc (i1 );
154162 printf ("interval[%d]: %s\n" , i , text ? text : "-" );
155163 free (text );
164+
165+ ic = PGTYPESinterval_new ();
166+ PGTYPESinterval_copy (i1 , ic );
167+ text = PGTYPESinterval_to_asc (i1 );
168+ printf ("interval_copy[%d]: %s\n" , i , text ? text : "-" );
169+ free (text );
170+ PGTYPESinterval_free (ic );
156171 }
157172
158173 return (0 );
0 commit comments