Reject operator names >= NAMEDATALEN characters. These will not work
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Aug 2005 00:48:29 +0000 (00:48 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Aug 2005 00:48:29 +0000 (00:48 +0000)
anyway, and in assert-enabled builds you are likely to get an assertion
failure.  Backpatch as far as 7.3; 7.2 seems not to have the problem.

src/backend/parser/scan.l

index ca555ecb389dc8b5d45e6b416cca8482bca61ff4..828fa82f1d07529163c9221297be5dbfe109e847 100644 (file)
@@ -534,6 +534,15 @@ other                      .
                                                        return yytext[0];
                                        }
 
+                                       /*
+                                        * Complain if operator is too long.  Unlike the case
+                                        * for identifiers, we make this an error not a notice-
+                                        * and-truncate, because the odds are we are looking at
+                                        * a syntactic mistake anyway.
+                                        */
+                                       if (nchars >= NAMEDATALEN)
+                                               yyerror("operator too long");
+
                                        /* Convert "!=" operator to "<>" for compatibility */
                                        if (strcmp(yytext, "!=") == 0)
                                                yylval.str = pstrdup("<>");