Remove grammar productions for prefix and postfix % and ^ operators,

as well as the existing pg_catalog entries for prefix and postfix %.
These have never been documented, though they did appear in one old
regression test.  This avoids surprising behavior in cases like
"SELECT -25 % -10".  Per recent discussion.
Note: although there is a catalog change here, I did not force initdb
since there's no harm in leaving the inaccessible entries in one's
copy of pg_operator.
This commit is contained in:
Tom Lane 2005-06-08 21:15:29 +00:00
parent f5b2f60bd1
commit 77c168a836
9 changed files with 16 additions and 34 deletions

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/comment.sgml,v 1.28 2005/05/26 20:05:03 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/comment.sgml,v 1.29 2005/06/08 21:15:27 tgl Exp $
PostgreSQL documentation
-->
@ -243,7 +243,7 @@ COMMENT ON INDEX my_index IS 'Enforces uniqueness on employee ID';
COMMENT ON LANGUAGE plpython IS 'Python support for stored procedures';
COMMENT ON LARGE OBJECT 346344 IS 'Planning document';
COMMENT ON OPERATOR ^ (text, text) IS 'Performs intersection of two texts';
COMMENT ON OPERATOR ^ (NONE, text) IS 'This is a prefix operator on text';
COMMENT ON OPERATOR - (NONE, text) IS 'This is a prefix operator on text';
COMMENT ON OPERATOR CLASS int4ops USING btree IS '4 byte integer operators for btrees';
COMMENT ON RULE my_rule ON my_table IS 'Logs updates of employee records';
COMMENT ON SCHEMA my_schema IS 'Departmental data';

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.491 2005/05/07 02:22:46 momjian Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.492 2005/06/08 21:15:28 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -6099,14 +6099,6 @@ a_expr: c_expr { $$ = $1; }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", NULL, $2); }
| '-' a_expr %prec UMINUS
{ $$ = doNegate($2); }
| '%' a_expr
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", NULL, $2); }
| '^' a_expr
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", NULL, $2); }
| a_expr '%'
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", $1, NULL); }
| a_expr '^'
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", $1, NULL); }
| a_expr '+' a_expr
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", $1, $3); }
| a_expr '-' a_expr
@ -6468,14 +6460,6 @@ b_expr: c_expr
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", NULL, $2); }
| '-' b_expr %prec UMINUS
{ $$ = doNegate($2); }
| '%' b_expr
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", NULL, $2); }
| '^' b_expr
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", NULL, $2); }
| b_expr '%'
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", $1, NULL); }
| b_expr '^'
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", $1, NULL); }
| b_expr '+' b_expr
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", $1, $3); }
| b_expr '-' b_expr

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.132 2005/05/30 20:59:17 momjian Exp $
* $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.133 2005/06/08 21:15:28 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -259,8 +259,6 @@ DATA(insert OID = 594 ( "*" PGNSP PGUID b f 701 701 701 594 0 0 0 0 0 f
DATA(insert OID = 595 ( "@" PGNSP PGUID l f 0 701 701 0 0 0 0 0 0 float8abs - - ));
DATA(insert OID = 596 ( "|/" PGNSP PGUID l f 0 701 701 0 0 0 0 0 0 dsqrt - - ));
DATA(insert OID = 597 ( "||/" PGNSP PGUID l f 0 701 701 0 0 0 0 0 0 dcbrt - - ));
DATA(insert OID = 598 ( "%" PGNSP PGUID l f 0 701 701 0 0 0 0 0 0 dtrunc - - ));
DATA(insert OID = 599 ( "%" PGNSP PGUID r f 701 0 701 0 0 0 0 0 0 dround - - ));
DATA(insert OID = 1284 ( "|" PGNSP PGUID l f 0 704 702 0 0 0 0 0 0 tintervalstart - - ));
DATA(insert OID = 606 ( "<#>" PGNSP PGUID b f 702 702 704 0 0 0 0 0 0 mktinterval - - ));
DATA(insert OID = 607 ( "=" PGNSP PGUID b t 26 26 16 607 608 609 609 609 610 oideq eqsel eqjoinsel ));

View File

@ -204,7 +204,7 @@ SELECT '' AS five, f.f1, @f.f1 AS abs_f1
(5 rows)
-- truncate
SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
SELECT '' AS five, f.f1, trunc(f.f1) AS trunc_f1
FROM FLOAT8_TBL f;
five | f1 | trunc_f1
------+----------------------+----------------------
@ -216,7 +216,7 @@ SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
(5 rows)
-- round
SELECT '' AS five, f.f1, f.f1 % AS round_f1
SELECT '' AS five, f.f1, round(f.f1) AS round_f1
FROM FLOAT8_TBL f;
five | f1 | round_f1
------+----------------------+----------------------

View File

@ -203,7 +203,7 @@ SELECT '' AS five, f.f1, @f.f1 AS abs_f1
(5 rows)
-- truncate
SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
SELECT '' AS five, f.f1, trunc(f.f1) AS trunc_f1
FROM FLOAT8_TBL f;
five | f1 | trunc_f1
------+----------------------+----------------------
@ -215,7 +215,7 @@ SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
(5 rows)
-- round
SELECT '' AS five, f.f1, f.f1 % AS round_f1
SELECT '' AS five, f.f1, round(f.f1) AS round_f1
FROM FLOAT8_TBL f;
five | f1 | round_f1
------+----------------------+----------------------

View File

@ -212,7 +212,7 @@ SELECT '' AS five, f.f1, @f.f1 AS abs_f1
(5 rows)
-- truncate
SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
SELECT '' AS five, f.f1, trunc(f.f1) AS trunc_f1
FROM FLOAT8_TBL f;
five | f1 | trunc_f1
------+----------------------+----------------------
@ -224,7 +224,7 @@ SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
(5 rows)
-- round
SELECT '' AS five, f.f1, f.f1 % AS round_f1
SELECT '' AS five, f.f1, round(f.f1) AS round_f1
FROM FLOAT8_TBL f;
five | f1 | round_f1
------+----------------------+----------------------

View File

@ -212,7 +212,7 @@ SELECT '' AS five, f.f1, @f.f1 AS abs_f1
(5 rows)
-- truncate
SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
SELECT '' AS five, f.f1, trunc(f.f1) AS trunc_f1
FROM FLOAT8_TBL f;
five | f1 | trunc_f1
------+----------------------+----------------------
@ -224,7 +224,7 @@ SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
(5 rows)
-- round
SELECT '' AS five, f.f1, f.f1 % AS round_f1
SELECT '' AS five, f.f1, round(f.f1) AS round_f1
FROM FLOAT8_TBL f;
five | f1 | round_f1
------+----------------------+----------------------

View File

@ -204,7 +204,7 @@ SELECT '' AS five, f.f1, @f.f1 AS abs_f1
(5 rows)
-- truncate
SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
SELECT '' AS five, f.f1, trunc(f.f1) AS trunc_f1
FROM FLOAT8_TBL f;
five | f1 | trunc_f1
------+----------------------+----------------------
@ -216,7 +216,7 @@ SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
(5 rows)
-- round
SELECT '' AS five, f.f1, f.f1 % AS round_f1
SELECT '' AS five, f.f1, round(f.f1) AS round_f1
FROM FLOAT8_TBL f;
five | f1 | round_f1
------+----------------------+----------------------

View File

@ -79,11 +79,11 @@ SELECT '' AS five, f.f1, @f.f1 AS abs_f1
FROM FLOAT8_TBL f;
-- truncate
SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
SELECT '' AS five, f.f1, trunc(f.f1) AS trunc_f1
FROM FLOAT8_TBL f;
-- round
SELECT '' AS five, f.f1, f.f1 % AS round_f1
SELECT '' AS five, f.f1, round(f.f1) AS round_f1
FROM FLOAT8_TBL f;
-- ceil / ceiling