Fixes for pg_dump.c regarding multiranges
authorAlexander Korotkov <[email protected]>
Sun, 20 Dec 2020 05:14:35 +0000 (08:14 +0300)
committerAlexander Korotkov <[email protected]>
Sun, 20 Dec 2020 05:14:35 +0000 (08:14 +0300)
This commit fixes two wrong version number checks and one wrong check for null.

src/bin/pg_dump/pg_dump.c

index 03023a382c0e3dffd94ca4f2ebdb1e3d5e9041f9..8b1e5cc2b59d30c113408600651645dbd413d45a 100644 (file)
@@ -4541,7 +4541,7 @@ binary_upgrade_set_type_oids_by_type_oid(Archive *fout,
     */
    if (include_multirange_type)
    {
-       if (fout->remoteVersion >= 130000)
+       if (fout->remoteVersion >= 140000)
        {
            appendPQExpBuffer(upgrade_query,
                              "SELECT t.oid, t.typarray "
@@ -8402,7 +8402,7 @@ getCasts(Archive *fout, int *numCasts)
    int         i_castcontext;
    int         i_castmethod;
 
-   if (fout->remoteVersion >= 130000)
+   if (fout->remoteVersion >= 140000)
    {
        appendPQExpBufferStr(query, "SELECT tableoid, oid, "
                             "castsource, casttarget, castfunc, castcontext, "
@@ -10709,7 +10709,7 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo)
    appendPQExpBuffer(q, "\n    subtype = %s",
                      PQgetvalue(res, 0, PQfnumber(res, "rngsubtype")));
 
-   if (PQgetvalue(res, 0, PQfnumber(res, "rngmultitype")))
+   if (!PQgetisnull(res, 0, PQfnumber(res, "rngmultitype")))
        appendPQExpBuffer(q, ",\n    multirange_type_name = %s",
                          PQgetvalue(res, 0, PQfnumber(res, "rngmultitype")));