From 30d17f3195ca1c3f19ed0f59e3cb4f39efa992c9 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Thu, 1 Jun 2000 22:23:10 +0000
Subject: [PATCH] Lexer defended us against overlength plain identifiers, but
 not against overlength quoted identifiers.  Death and destruction ensue...

---
 src/backend/parser/scan.l | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l
index 64a389b7680..3934402888e 100644
--- a/src/backend/parser/scan.l
+++ b/src/backend/parser/scan.l
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.68 2000/03/18 18:03:09 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.68.2.1 2000/06/01 22:23:10 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,6 +42,7 @@ static char *parseCh;
 /* set up my input handler --- need one flavor for flex, one for lex */
 #if defined(FLEX_SCANNER)
 
+#define YY_NEVER_INTERACTIVE 1
 #define YY_NO_UNPUT
 static int myinput(char* buf, int max);
 #undef YY_INPUT
@@ -325,6 +326,12 @@ other			.
 				}
 <xd>{xdstop}	{
 					BEGIN(INITIAL);
+					if (strlen(literalbuf) >= NAMEDATALEN)
+					{
+						elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"",
+							 literalbuf, NAMEDATALEN-1, literalbuf);
+						literalbuf[NAMEDATALEN-1] = '\0';
+					}
 					yylval.str = pstrdup(literalbuf);
 					return IDENT;
 				}
-- 
GitLab