diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-16 00:48:12 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-16 00:48:12 +0000 |
commit | 6629bc79f1ec09e49c17812789546606c96122fd (patch) | |
tree | 1e8a120dd5f9432a66714cca8c697392ff64d89c /src | |
parent | 070a3ad76b65c9eff572da5d358c563ccc7bb14f (diff) | |
download | postgresql-6629bc79f1ec09e49c17812789546606c96122fd.tar.gz postgresql-6629bc79f1ec09e49c17812789546606c96122fd.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 f9b0dbdb75b..2a56c44a56b 100644 --- a/src/backend/parser/scan.l +++ b/src/backend/parser/scan.l @@ -24,7 +24,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.127 2005/06/26 19:16:05 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.128 2005/08/16 00:48:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -633,6 +633,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("<>"); |