diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml
index 4b0eed30cf5d2e9c79e00dc36ed70cba572c99f9..7f0f785d4b686d01262f8d6cdae85fb6e4879c0b 100644
--- a/doc/src/sgml/ecpg.sgml
+++ b/doc/src/sgml/ecpg.sgml
@@ -2,7 +2,7 @@
 <DocInfo>
 <AuthorGroup>
 <Author>
-<FirstName>Linux</FirstName>
+<FirstName>Linus</FirstName>
 <Surname>Tolke</Surname>
 </Author>
 <Author>
diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index 846aa8a158a9124e7370a6a2431b4fd6c60c671d..a7882c20a1e108dff3c987c8f398ec2b3e1f53c4 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -848,5 +848,9 @@ Thu Mar  2 17:42:16 CET 2000
 
 	- Print error message if an indicator array is given for input
 	  variables.
+
+Fri Mar  3 10:47:06 CET 2000
+
+	- Fixed handling of double quote in C code.
 	- Set library version to 3.1.0.
 	- Set ecpg version to 2.7.0.
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index fcb033787c5cee03b265cd6d6a5aadd49933c298..ec265dded162ad3d04cd8a0b30d2fd4774cf4013 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.51 2000/02/22 19:57:10 meskes Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.52 2000/03/03 09:56:03 meskes Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -51,7 +51,7 @@ static int		literalalloc;	/* current allocated buffer size */
 #define startlit()  (literalbuf[0] = '\0', literallen = 0)
 static void addlit(char *ytext, int yleng);
 
-int before_comment;
+int state_before;
 
 struct _yy_buffer { YY_BUFFER_STATE 	buffer;
 		    long		lineno;
@@ -268,12 +268,12 @@ cppline			{space}*#(.*\\{line_end})*.*
 {xcline}		{ ECHO; }
 
 {xcstart}		{
-				before_comment = YYSTATE;
+				state_before = YYSTATE;
 				ECHO;
 	 			BEGIN(xc);
 			}
 
-<xc>{xcstop}	{ ECHO; BEGIN(before_comment); }
+<xc>{xcstop}	{ ECHO; BEGIN(state_before); }
 
 <xc>{xcinside}	{ ECHO; }
 
@@ -303,7 +303,7 @@ cppline			{space}*#(.*\\{line_end})*.*
 					BEGIN(xh);
 					startlit();
 				}
-<xh>{xhstop}	{
+<xh>{xhstop}			{
 					char* endptr;
 
 					BEGIN(SQL);
@@ -314,45 +314,36 @@ cppline			{space}*#(.*\\{line_end})*.*
 					return ICONST;
 				}
 
-<SQL>{xqstart}		{
+{xqstart}			{
+					state_before == YYSTATE;
 					BEGIN(xq);
 					startlit();
 				}
-<xq>{xqstop}	{
-					BEGIN(SQL);
+<xq>{xqstop}			{
+					BEGIN(state_before);
 					yylval.str = mm_strdup(literalbuf);
 					return SCONST;
 				}
 <xq>{xqdouble}	|
 <xq>{xqinside}	|
-<xq>{xqliteral} {
+<xq>{xqliteral} 		{
 					addlit(yytext, yyleng);
 				}
-<xq>{xqcat}		{		/* ignore */
+<xq>{xqcat}			{
+					/* ignore */
 				}
 
-<SQL>{xdstart}		{
+{xdstart}			{
+					state_before = YYSTATE;
 					BEGIN(xd);
 					startlit();
 				}
-<xd>{xdstop}	{
-					BEGIN(SQL);
-					yylval.str = mm_strdup(literalbuf);
-					return CSTRING;
-				}
-<xd>{xdinside}	{
-					addlit(yytext, yyleng);
-				}
-{xdstart}		{
-					BEGIN(xdc);
-					startlit();
-				}
-<xdc>{xdstop}	{
-					BEGIN(C);
+<xd>{xdstop}			{
+					BEGIN(state_before);
 					yylval.str = mm_strdup(literalbuf);
 					return CSTRING;
 				}
-<xdc>{xdcinside}	{
+<xd>{xdinside}			{
 					addlit(yytext, yyleng);
 				}
 <SQL>{typecast}			{ 	return TYPECAST; }
@@ -365,7 +356,7 @@ cppline			{space}*#(.*\\{line_end})*.*
 					 BEGIN C;
 				  return yytext[0];
 				}
-<SQL>{operator}		{
+<SQL>{operator}			{
 					if (strcmp((char*)yytext,"!=") == 0)
 						yylval.str = mm_strdup("<>"); /* compatability */
 					else
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index d3abd002286061b873483838992526a1b1ff211a..88591f831bc30ad5b16bed954a2ae9d356552d0a 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -5086,6 +5086,7 @@ c_anything:  IDENT 	{ $$ = $1; }
 	| CSTRING	{ $$ = make3_str(make_str("\""), $1, make_str("\"")); }
 	| Iconst	{ $$ = $1; }
 	| Fconst	{ $$ = $1; }
+	| Sconst	{ $$ = $1; }
 	| '*'		{ $$ = make_str("*"); }
 	| '+'		{ $$ = make_str("+"); }
 	| '-'		{ $$ = make_str("-"); }
@@ -5112,8 +5113,6 @@ c_anything:  IDENT 	{ $$ = $1; }
 	| VARCHAR	{ $$ = make_str("varchar"); }
         | '['		{ $$ = make_str("["); }
 	| ']'		{ $$ = make_str("]"); }
-/*        | '('		{ $$ = make_str("("); }
-	| ')'		{ $$ = make_str(")"); }*/
 	| '='		{ $$ = make_str("="); }
 
 blockstart : '{' {