Lexer defended us against overlength plain identifiers, but not against
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 1 Jun 2000 22:21:05 +0000 (22:21 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 1 Jun 2000 22:21:05 +0000 (22:21 +0000)
overlength quoted identifiers.  Death and destruction ensue...

src/backend/parser/scan.l

index 6d904198209d0ffae3fb471651c95dc9f5536a8d..0d3b07f0bb7ed786d35c65669470f168318bd56e 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.70 2000/05/29 05:44:54 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.71 2000/06/01 22:21:05 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -326,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;
                                }