]> granicus.if.org Git - postgresql/commitdiff
Simplify pg_upgrade queries by using IN instead of multiple OR clauses
authorBruce Momjian <bruce@momjian.us>
Wed, 19 May 2010 18:56:47 +0000 (18:56 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 19 May 2010 18:56:47 +0000 (18:56 +0000)
comparing the same column to multiple values.

contrib/pg_upgrade/info.c

index 4fcaeb22d4426991ebb1ccc41ad843a85f96a080..756e8ffd8598238dd86197b9f99b7aaa65c4b4d6 100644 (file)
@@ -327,11 +327,9 @@ get_rel_infos(migratorContext *ctx, const DbInfo *dbinfo,
                         "      AND c.oid >= %u "
                         "      ) OR ( "
                         "      n.nspname = 'pg_catalog' "
-                        "      AND (relname = 'pg_largeobject' OR "
-                        "               relname = 'pg_largeobject_loid_pn_index') )) "
-                        "      AND "
-                        "      (relkind = 'r' OR relkind = 't' OR "
-                        "       relkind = 'i'%s)"
+                        "      AND relname IN "
+                        "        ('pg_largeobject', 'pg_largeobject_loid_pn_index') )) "
+                        "      AND relkind IN ('r','t', 'i'%s)"
                         "GROUP BY  c.oid, n.nspname, c.relname, c.relfilenode,"
                         "                      c.reltoastrelid, t.spclocation, "
                         "                      n.nspname "
@@ -339,7 +337,7 @@ get_rel_infos(migratorContext *ctx, const DbInfo *dbinfo,
                         FirstNormalObjectId,
        /* see the comment at the top of old_8_3_create_sequence_script() */
                         (GET_MAJOR_VERSION(ctx->old.major_version) <= 803) ?
-                        "" : " OR relkind = 'S'");
+                        "" : ", 'S'");
 
        res = executeQueryOrDie(ctx, conn, query);