diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-16 00:48:29 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-16 00:48:29 +0000 |
commit | 96fc1a4f778eaad63c4bb41622e37a07fd433749 (patch) | |
tree | 299ecde26f25e780e46938a9acfa4ee9130e914f /src | |
parent | ab648632eb4d3d36c012350f9c5643deb4736791 (diff) | |
download | postgresql-96fc1a4f778eaad63c4bb41622e37a07fd433749.tar.gz postgresql-96fc1a4f778eaad63c4bb41622e37a07fd433749.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/parser/scan.l | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l index 7e944467bd0..433e42bf6a0 100644 --- a/src/backend/parser/scan.l +++ b/src/backend/parser/scan.l @@ -10,7 +10,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.119 2004/12/31 22:00:27 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.119.4.1 2005/08/16 00:48:29 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -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("<>"); |