diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index fff7d1301ad5266f0e993c11694514c968d8e521..2fc29e75379933d8812a0cde1d5aed669b416426 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -1546,6 +1546,10 @@ Wed Jul  2 09:45:59 CEST 2003
 
 	- Fixed initialization bug in compatlib.
 	- Added postgres_fe.h to all files in pgtypeslib.
+	
+Fri Jul  4 13:51:11 CEST 2003
+
+	- date, interval and timestamp data should be quoted. 
 	- Set ecpg version to 3.0.0
 	- Set ecpg library to 4.0.0
 	- Set pgtypes library to 1.0.0
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 87d528533de43fa66b62ca6b1aafa61dcfb7da03..ec6be71fa7b008b5ae7f619adbec5ceaafba3a8c 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.15 2003/07/04 11:30:48 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.16 2003/07/04 12:00:52 meskes Exp $ */
 
 /*
  * The aim is to get a simpler inteface to the database routines.
@@ -885,7 +885,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
 					{
 						for (element = 0; element < var->arrsize; element++)
 						{
-							str = PGTYPESinterval_to_asc((Interval *)((var + var->offset * element)->value));
+							str = quote_postgres(PGTYPESinterval_to_asc((Interval *)((var + var->offset * element)->value)), stmt->lineno);
 							slen = strlen (str);
 							
 							if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + 5, stmt->lineno)))
@@ -901,7 +901,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
 					}
 					else
 					{
-						str = PGTYPESinterval_to_asc((Interval *)(var->value));
+						str = quote_postgres(PGTYPESinterval_to_asc((Interval *)(var->value)), stmt->lineno);
 						slen = strlen (str);
 					
 						if (!(mallocedval = ECPGalloc(slen + 1, stmt->lineno)))
@@ -926,7 +926,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
 					{
 						for (element = 0; element < var->arrsize; element++)
 						{
-							str = PGTYPESdate_to_asc(*(Date *)((var + var->offset * element)->value));
+							str = quote_postgres(PGTYPESdate_to_asc(*(Date *)((var + var->offset * element)->value)), stmt->lineno);
 							slen = strlen (str);
 							
 							if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + 5, stmt->lineno)))
@@ -942,7 +942,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
 					}
 					else
 					{
-						str = PGTYPESdate_to_asc(*(Date *)(var->value));
+						str = quote_postgres(PGTYPESdate_to_asc(*(Date *)(var->value)), stmt->lineno);
 						slen = strlen (str);
 					
 						if (!(mallocedval = ECPGalloc(slen + 1, stmt->lineno)))
@@ -967,7 +967,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
 					{
 						for (element = 0; element < var->arrsize; element++)
 						{
-							str = PGTYPEStimestamp_to_asc(*(Timestamp *)((var + var->offset * element)->value));
+							str = quote_postgres(PGTYPEStimestamp_to_asc(*(Timestamp *)((var + var->offset * element)->value)), stmt->lineno);
 							slen = strlen (str);
 							
 							if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + 5, stmt->lineno)))
@@ -983,7 +983,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
 					}
 					else
 					{
-						str = PGTYPEStimestamp_to_asc(*(Timestamp *)(var->value));
+						str = quote_postgres(PGTYPEStimestamp_to_asc(*(Timestamp *)(var->value)), stmt->lineno);
 						slen = strlen (str);
 					
 						if (!(mallocedval = ECPGalloc(slen + 1, stmt->lineno)))
diff --git a/src/interfaces/ecpg/pgtypeslib/datetime.c b/src/interfaces/ecpg/pgtypeslib/datetime.c
index 9811571afc15b29b7ad15b100dcd350bc7017676..d9ca8708734d15b8cffeb15360ea5904a14b2613 100644
--- a/src/interfaces/ecpg/pgtypeslib/datetime.c
+++ b/src/interfaces/ecpg/pgtypeslib/datetime.c
@@ -87,7 +87,7 @@ PGTYPESdate_to_asc(Date dDate)
 {
 	struct tm       tt, *tm = &tt;
 	char            buf[MAXDATELEN + 1];
-	int DateStyle=0;
+	int DateStyle=1;
 	bool		EuroDates = FALSE;
 						   
 	j2date((dDate + date2j(2000, 1, 1)), &(tm->tm_year), &(tm->tm_mon), &(tm->tm_mday));
diff --git a/src/interfaces/ecpg/test/dt_test.pgc b/src/interfaces/ecpg/test/dt_test.pgc
index a5eb7cce9bb911e3bd082cb61f942a3b9df34373..515ea35aac01ad8ab1cb2cb092e0112f85ba7102 100644
--- a/src/interfaces/ecpg/test/dt_test.pgc
+++ b/src/interfaces/ecpg/test/dt_test.pgc
@@ -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 */