Ignore RECHECK in CREATE OPERATOR CLASS, just throwing a NOTICE, instead of
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 27 May 2009 20:42:29 +0000 (20:42 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 27 May 2009 20:42:29 +0000 (20:42 +0000)
throwing an error as 8.4 had been doing.  The error interfered with porting
old database definitions (particularly for pg_migrator) without really buying
any safety.  Per bug #4817 and subsequent discussion.

src/backend/parser/gram.y
src/bin/pg_dump/pg_dump.c

index b5ec7cbd079ef3255b126ff5edc4e5a339628e37..9a4535501ab4c44fd56a5c85013ac40ebd9f4b27 100644 (file)
@@ -3639,9 +3639,14 @@ opt_opfamily:    FAMILY any_name                         { $$ = $2; }
 
 opt_recheck:   RECHECK
                                {
-                                       ereport(ERROR,
+                                       /*
+                                        * 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 supported"),
+                                                        errmsg("RECHECK is no longer required"),
                                                         errhint("Update your data type."),
                                                         scanner_errposition(@1)));
                                        $$ = TRUE;
index 826215068c99fb1f6ca3f36f6d4b0663ca2d686e..a971b1c899a757cb41f16c1bd04b35455d88c51d 100644 (file)
@@ -8159,8 +8159,10 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
                 * pg_depend entries.
                 *
                 * XXX RECHECK is gone as of 8.4, but we'll still print it if dumping
-                * an older server's table in which it is used.  Would it be better
-                * to silently ignore it?
+                * an older server's opclass in which it is used.  This is to avoid
+                * hard-to-detect breakage if a newer pg_dump is used to dump from
+                * an older server and then reload into that old version.  This can
+                * go away once 8.3 is so old as to not be of interest to anyone.
                 */
                appendPQExpBuffer(query, "SELECT amopstrategy, false AS amopreqcheck, "
                                                  "amopopr::pg_catalog.regoperator "
@@ -8370,8 +8372,10 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo)
        {
                /*
                 * XXX RECHECK is gone as of 8.4, but we'll still print it if dumping
-                * an older server's table in which it is used.  Would it be better
-                * to silently ignore it?
+                * an older server's opclass in which it is used.  This is to avoid
+                * hard-to-detect breakage if a newer pg_dump is used to dump from
+                * an older server and then reload into that old version.  This can
+                * go away once 8.3 is so old as to not be of interest to anyone.
                 */
                appendPQExpBuffer(query, "SELECT amopstrategy, false AS amopreqcheck, "
                                          "amopopr::pg_catalog.regoperator "