summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-08-16 00:48:43 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-08-16 00:48:43 +0000
commite2e2e15cf89ec67eeed443e4548b72e701a3d202 (patch)
tree00045aba76e50e46859de7c7c12ae27b6b6c6e9e
parentec70ca7954353773cd1de8d0ed719232aa2453ec (diff)
downloadpostgresql-e2e2e15cf89ec67eeed443e4548b72e701a3d202.tar.gz
Reject operator names >= NAMEDATALEN characters. These will not work
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.
-rw-r--r--src/backend/parser/scan.l11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l
index c3a423a7f4..c87752fc5e 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.111.2.1 2004/02/21 00:35:13 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.111.2.2 2005/08/16 00:48:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -479,6 +479,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("<>");