Skip to content

Instantly share code, notes, and snippets.

@danielgustafsson
Created February 9, 2018 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielgustafsson/3c0498436a5c97a3ddce10ef3b3c9ce3 to your computer and use it in GitHub Desktop.
Save danielgustafsson/3c0498436a5c97a3ddce10ef3b3c9ce3 to your computer and use it in GitHub Desktop.
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index def27e7dd6..d086ec90e0 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -5186,11 +5186,17 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
"a.attnotnull, a.atthasdef, a.attisdropped, "
"a.attlen, a.attalign, a.attislocal, "
"pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname "
+ " %s "
"FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t "
"ON a.atttypid = t.oid "
+ " %s "
"WHERE a.attrelid = '%u'::pg_catalog.oid "
"AND a.attnum > 0::pg_catalog.int2 "
"ORDER BY a.attrelid, a.attnum",
+ (gp_attribute_encoding_available ?
+ ", pg_catalog.array_to_string(e.attoptions, ',') AS attencoding " : ""),
+ (gp_attribute_encoding_available ?
+ "LEFT OUTER JOIN pg_catalog.pg_attribute_encoding e ON e.attrelid = a.attrelid AND e.attnum = a.attnum " : ""),
tbinfo->dobj.catId.oid);
}
else if (g_fout->remoteVersion >= 70300)
@@ -5295,7 +5301,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
tbinfo->inhNotNull[j] = false;
/* column storage attributes */
- if (gp_attribute_encoding_available && i_attencoding > 0 && !PQgetisnull(res, j, i_attencoding))
+ if (gp_attribute_encoding_available && !PQgetisnull(res, j, i_attencoding))
tbinfo->attencoding[j] = strdup(PQgetvalue(res, j, i_attencoding));
else
tbinfo->attencoding[j] = NULL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment