Remove obsolete RECHECK keyword completely

Started by Peter Eisentrautover 1 year ago4 messages
#1Peter Eisentraut
peter@eisentraut.org
1 attachment(s)

I propose to remove the obsolete RECHECK keyword completely. This used
to be part of CREATE OPERATOR CLASS and ALTER OPERATOR FAMILY, but it
has done nothing (except issue a NOTICE) since PostgreSQL 8.4. Commit
30e7c175b81 removed support for dumping from pre-9.2 servers, so this no
longer serves any need, it seems to me.

This now removes it completely, and you'd get a normal parse error if
you used it.

Attachments:

0001-Remove-obsolete-RECHECK-keyword-completely.patchtext/plain; charset=UTF-8; name=0001-Remove-obsolete-RECHECK-keyword-completely.patchDownload
From 284e0a8f4729d9d6507ae0029cad637b7d870d41 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Fri, 2 Aug 2024 12:37:33 +0200
Subject: [PATCH] Remove obsolete RECHECK keyword completely

This used to be part of CREATE OPERATOR CLASS and ALTER OPERATOR
FAMILY, but it has done nothing (except issue a NOTICE) since
PostgreSQL 8.4.  Commit 30e7c175b81 removed support for dumping from
pre-9.2 servers, so this no longer serves any need.

This now removes it completely, and you'd get a normal parse error if
you used it.
---
 doc/src/sgml/ref/alter_opfamily.sgml          |  8 ------
 doc/src/sgml/ref/create_opclass.sgml          |  8 ------
 src/backend/parser/gram.y                     | 26 +++----------------
 src/include/parser/kwlist.h                   |  1 -
 .../isolation/specs/merge-match-recheck.spec  |  2 +-
 5 files changed, 4 insertions(+), 41 deletions(-)

diff --git a/doc/src/sgml/ref/alter_opfamily.sgml b/doc/src/sgml/ref/alter_opfamily.sgml
index b2e5b9b72ec..5c4c2e579f5 100644
--- a/doc/src/sgml/ref/alter_opfamily.sgml
+++ b/doc/src/sgml/ref/alter_opfamily.sgml
@@ -273,14 +273,6 @@ <title>Notes</title>
    is likely to be inlined into the calling query, which will prevent
    the optimizer from recognizing that the query matches an index.
   </para>
-
-  <para>
-   Before <productname>PostgreSQL</productname> 8.4, the <literal>OPERATOR</literal>
-   clause could include a <literal>RECHECK</literal> option.  This is no longer
-   supported because whether an index operator is <quote>lossy</quote> is now
-   determined on-the-fly at run time.  This allows efficient handling of
-   cases where an operator might or might not be lossy.
-  </para>
  </refsect1>
 
  <refsect1>
diff --git a/doc/src/sgml/ref/create_opclass.sgml b/doc/src/sgml/ref/create_opclass.sgml
index f1d6a4cbbe2..2d560b68658 100644
--- a/doc/src/sgml/ref/create_opclass.sgml
+++ b/doc/src/sgml/ref/create_opclass.sgml
@@ -269,14 +269,6 @@ <title>Notes</title>
    is likely to be inlined into the calling query, which will prevent
    the optimizer from recognizing that the query matches an index.
   </para>
-
-  <para>
-   Before <productname>PostgreSQL</productname> 8.4, the <literal>OPERATOR</literal>
-   clause could include a <literal>RECHECK</literal> option.  This is no longer
-   supported because whether an index operator is <quote>lossy</quote> is now
-   determined on-the-fly at run time.  This allows efficient handling of
-   cases where an operator might or might not be lossy.
-  </para>
  </refsect1>
 
  <refsect1>
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index a043fd4c669..c3f25582c38 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -495,7 +495,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
 
 %type <boolean> opt_instead
 %type <boolean> opt_unique opt_verbose opt_full
-%type <boolean> opt_freeze opt_analyze opt_default opt_recheck
+%type <boolean> opt_freeze opt_analyze opt_default
 %type <defelt>	opt_binary copy_delimiter
 
 %type <boolean> copy_from opt_program
@@ -770,7 +770,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
 
 	QUOTE QUOTES
 
-	RANGE READ REAL REASSIGN RECHECK RECURSIVE REF_P REFERENCES REFERENCING
+	RANGE READ REAL REASSIGN RECURSIVE REF_P REFERENCES REFERENCING
 	REFRESH REINDEX RELATIVE_P RELEASE RENAME REPEATABLE REPLACE REPLICA
 	RESET RESTART RESTRICT RETURN RETURNING RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP
 	ROUTINE ROUTINES ROW ROWS RULE
@@ -6622,7 +6622,7 @@ opclass_item_list:
 		;
 
 opclass_item:
-			OPERATOR Iconst any_operator opclass_purpose opt_recheck
+			OPERATOR Iconst any_operator opclass_purpose
 				{
 					CreateOpClassItem *n = makeNode(CreateOpClassItem);
 					ObjectWithArgs *owa = makeNode(ObjectWithArgs);
@@ -6636,7 +6636,6 @@ opclass_item:
 					$$ = (Node *) n;
 				}
 			| OPERATOR Iconst operator_with_argtypes opclass_purpose
-			  opt_recheck
 				{
 					CreateOpClassItem *n = makeNode(CreateOpClassItem);
 
@@ -6688,23 +6687,6 @@ opclass_purpose: FOR SEARCH					{ $$ = NIL; }
 			| /*EMPTY*/						{ $$ = NIL; }
 		;
 
-opt_recheck:	RECHECK
-				{
-					/*
-					 * RECHECK no longer does anything in opclass definitions,
-					 * but we still accept it to ease porting of old database
-					 * dumps.
-					 */
-					ereport(NOTICE,
-							(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-							 errmsg("RECHECK is no longer required"),
-							 errhint("Update your data type."),
-							 parser_errposition(@1)));
-					$$ = true;
-				}
-			| /*EMPTY*/						{ $$ = false; }
-		;
-
 
 CreateOpFamilyStmt:
 			CREATE OPERATOR FAMILY any_name USING name
@@ -17784,7 +17766,6 @@ unreserved_keyword:
 			| RANGE
 			| READ
 			| REASSIGN
-			| RECHECK
 			| RECURSIVE
 			| REF_P
 			| REFERENCING
@@ -18414,7 +18395,6 @@ bare_label_keyword:
 			| READ
 			| REAL
 			| REASSIGN
-			| RECHECK
 			| RECURSIVE
 			| REF_P
 			| REFERENCES
diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h
index f7fe834cf45..bb191b1f469 100644
--- a/src/include/parser/kwlist.h
+++ b/src/include/parser/kwlist.h
@@ -363,7 +363,6 @@ PG_KEYWORD("range", RANGE, UNRESERVED_KEYWORD, BARE_LABEL)
 PG_KEYWORD("read", READ, UNRESERVED_KEYWORD, BARE_LABEL)
 PG_KEYWORD("real", REAL, COL_NAME_KEYWORD, BARE_LABEL)
 PG_KEYWORD("reassign", REASSIGN, UNRESERVED_KEYWORD, BARE_LABEL)
-PG_KEYWORD("recheck", RECHECK, UNRESERVED_KEYWORD, BARE_LABEL)
 PG_KEYWORD("recursive", RECURSIVE, UNRESERVED_KEYWORD, BARE_LABEL)
 PG_KEYWORD("ref", REF_P, UNRESERVED_KEYWORD, BARE_LABEL)
 PG_KEYWORD("references", REFERENCES, RESERVED_KEYWORD, BARE_LABEL)
diff --git a/src/test/isolation/specs/merge-match-recheck.spec b/src/test/isolation/specs/merge-match-recheck.spec
index 298b2bfdcd6..26266b8c297 100644
--- a/src/test/isolation/specs/merge-match-recheck.spec
+++ b/src/test/isolation/specs/merge-match-recheck.spec
@@ -1,4 +1,4 @@
-# MERGE MATCHED RECHECK
+# MERGE MATCHED recheck
 #
 # This test looks at what happens when we have complex
 # WHEN MATCHED AND conditions and a concurrent UPDATE causes a

base-commit: 9fb855fe1ae04a147bd4cdaa571a1c9de5f03682
-- 
2.45.2

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#1)
Re: Remove obsolete RECHECK keyword completely

Peter Eisentraut <peter@eisentraut.org> writes:

I propose to remove the obsolete RECHECK keyword completely. This used
to be part of CREATE OPERATOR CLASS and ALTER OPERATOR FAMILY, but it
has done nothing (except issue a NOTICE) since PostgreSQL 8.4. Commit
30e7c175b81 removed support for dumping from pre-9.2 servers, so this no
longer serves any need, it seems to me.

+1 for the idea; didn't vet the patch closely.

regards, tom lane

#3Aleksander Alekseev
aleksander@timescale.com
In reply to: Peter Eisentraut (#1)
Re: Remove obsolete RECHECK keyword completely

Hi,

I propose to remove the obsolete RECHECK keyword completely. This used
to be part of CREATE OPERATOR CLASS and ALTER OPERATOR FAMILY, but it
has done nothing (except issue a NOTICE) since PostgreSQL 8.4. Commit
30e7c175b81 removed support for dumping from pre-9.2 servers, so this no
longer serves any need, it seems to me.

This now removes it completely, and you'd get a normal parse error if
you used it.

I reviewed and tested the code. LGTM.

--
Best regards,
Aleksander Alekseev

#4Peter Eisentraut
peter@eisentraut.org
In reply to: Aleksander Alekseev (#3)
Re: Remove obsolete RECHECK keyword completely

On 05.08.24 15:44, Aleksander Alekseev wrote:

I propose to remove the obsolete RECHECK keyword completely. This used
to be part of CREATE OPERATOR CLASS and ALTER OPERATOR FAMILY, but it
has done nothing (except issue a NOTICE) since PostgreSQL 8.4. Commit
30e7c175b81 removed support for dumping from pre-9.2 servers, so this no
longer serves any need, it seems to me.

This now removes it completely, and you'd get a normal parse error if
you used it.

I reviewed and tested the code. LGTM.

committed, thanks