From fb5e9998df2787d5b4410a7f16db7247a0e031b0 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 12 Aug 2000 05:15:24 +0000 Subject: [PATCH] Mop-up for removal of ':' and ';' operators ... like, say, actually take 'em out of pg_operator. Also remove from scan.l's set of legal operator characters. Update documentation. --- doc/src/sgml/oper.sgml | 61 +++------------------------ doc/src/sgml/ref/create_operator.sgml | 8 ++-- src/backend/parser/gram.y | 8 ++-- src/backend/parser/scan.l | 4 +- src/include/catalog/pg_operator.h | 2 - 5 files changed, 16 insertions(+), 67 deletions(-) diff --git a/doc/src/sgml/oper.sgml b/doc/src/sgml/oper.sgml index b3fe010e58..add39e4fee 100644 --- a/doc/src/sgml/oper.sgml +++ b/doc/src/sgml/oper.sgml @@ -83,20 +83,10 @@ Operator Ordering (decreasing precedence) -UNION - - -left - - -SQL select construct - - - - :: +left Postgres typecasting @@ -135,40 +125,26 @@ right unary minus - - - -: - - -right - - -exponentiation +start of interval -| +^ left -start of interval +power, exclusive or @@ -228,6 +204,7 @@ test for NOT NULL (all other operators) +left native and user-defined @@ -265,7 +242,7 @@ time interval overlap -LIKE +LIKE ILIKE @@ -486,19 +463,6 @@ logical union Division 4 / 2 - - : - Natural Exponentiation - : 3.0 - - @ Absolute value @@ -523,17 +487,6 @@ Deprecated in v7.0, esp. since ln() is available as a generic function. - - - - - Two operators, ":" and ";", are now deprecated and will be removed in - the next release. Use the equivalent functions exp() and ln() - instead. - - - - diff --git a/doc/src/sgml/ref/create_operator.sgml b/doc/src/sgml/ref/create_operator.sgml index d24e54c475..c2e9f9c0a3 100644 --- a/doc/src/sgml/ref/create_operator.sgml +++ b/doc/src/sgml/ref/create_operator.sgml @@ -177,15 +177,15 @@ CREATE is a sequence of up to NAMEDATALEN-1 (31 by default) characters from the following list: -+ - * / < > = ~ ! @ # % ^ & | ` ? $ : ++ - * / < > = ~ ! @ # % ^ & | ` ? $ There are a few restrictions on your choice of name: - "$" and ":" cannot be defined as single-character operators, - although they can be part of a multi-character operator name. + "$" cannot be defined as a single-character operator, + although it can be part of a multi-character operator name. @@ -199,7 +199,7 @@ CREATE A multi-character operator name cannot end in "+" or "-", unless the name also contains at least one of these characters: -~ ! @ # % ^ & | ` ? $ : +~ ! @ # % ^ & | ` ? $ For example, @- is an allowed operator name, but *- is not. diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index f6dfadd54d..e43a24b025 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -363,7 +363,8 @@ static void doNegateFloat(Value *v); /* these are not real. they are here so that they get generated as #define's*/ %token OP -/* precedence */ +/* precedence: lowest to highest */ +%left UNION INTERSECT EXCEPT %left OR %left AND %right NOT @@ -381,15 +382,12 @@ static void doNegateFloat(Value *v); %left '+' '-' %left '*' '/' '%' %left '^' -%left '|' /* this is the relation union op, not logical or */ +%left '|' /* XXX Should this have such a high priority? */ /* Unary Operators */ -%right ':' /* delimiter for array ranges */ -%left ';' /* end of statement */ %right UMINUS %left '.' %left '[' ']' %left TYPECAST -%left UNION INTERSECT EXCEPT %left ESCAPE %% diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l index 6f39fe0cb9..f6dfb080a2 100644 --- a/src/backend/parser/scan.l +++ b/src/backend/parser/scan.l @@ -181,7 +181,7 @@ typecast "::" * rule for "operator"! */ self [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|] -op_chars [\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=] +op_chars [\~\!\@\#\^\&\|\`\?\$\+\-\*\/\%\<\>\=] operator {op_chars}+ /* we no longer allow unary minus in numbers. @@ -402,7 +402,7 @@ other . for (ic = nchars-2; ic >= 0; ic--) { - if (strchr("~!@#&`?$:%^|", yytext[ic])) + if (strchr("~!@#^&|`?$%", yytext[ic])) break; } if (ic >= 0) diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index 8e493fc782..7b3e561868 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -275,8 +275,6 @@ DATA(insert OID = 596 ( "|/" PGUID 0 l t f 0 701 701 0 0 0 0 dsqrt DATA(insert OID = 597 ( "||/" PGUID 0 l t f 0 701 701 0 0 0 0 dcbrt - - )); DATA(insert OID = 598 ( "%" PGUID 0 l t f 0 701 701 0 0 0 0 dtrunc - - )); DATA(insert OID = 599 ( "%" PGUID 0 r t f 701 0 701 0 0 0 0 dround - - )); -DATA(insert OID = 1282 ( ":" PGUID 0 l t f 0 701 701 0 0 0 0 dexp - - )); -DATA(insert OID = 1283 ( ";" PGUID 0 l t f 0 701 701 0 0 0 0 dlog1 - - )); DATA(insert OID = 1284 ( "|" PGUID 0 l t f 0 704 702 0 0 0 0 tintervalstart - - )); DATA(insert OID = 606 ( "<#>" PGUID 0 b t f 702 702 704 0 0 0 0 mktinterval - - )); DATA(insert OID = 607 ( "=" PGUID 0 b t t 26 26 16 607 608 609 609 oideq eqsel eqjoinsel )); -- 2.39.5