Commit 73b9952e authored by Tom Lane's avatar Tom Lane

Improve pg_upgrade's report about failure to match up old and new tables.

Ordinarily, pg_upgrade shouldn't have any difficulty in matching up all
the relations it sees in the old and new databases.  If it does, however,
it just goes belly-up with a pretty unhelpful error message.  That seemed
fine as long as we expected the case never to occur in the wild, but
Alvaro reported that it had been seen in a database whose pg_largeobject
table had somehow acquired a TOAST table.  That doesn't quite seem like
a case that pg_upgrade actually needs to handle, but it would be good if
the report were more diagnosable.  Hence, extend the logic to print out
as much information as we can about the mismatch(es) before we quit.

In passing, improve the readability of get_rel_infos()'s data collection
query, which had suffered seriously from lets-not-bother-to-update-comments
syndrome, and generally was unnecessarily disrespectful to readers.

It could be argued that this is a bug fix, but given that we have so few
reports, I don't feel a need to back-patch; at least not before this has
baked awhile in HEAD.
parent 06bd458c
This diff is collapsed.
...@@ -137,15 +137,16 @@ extern char *output_files[]; ...@@ -137,15 +137,16 @@ extern char *output_files[];
*/ */
typedef struct typedef struct
{ {
/* Can't use NAMEDATALEN; not guaranteed to fit on client */ /* Can't use NAMEDATALEN; not guaranteed to be same on client */
char *nspname; /* namespace name */ char *nspname; /* namespace name */
char *relname; /* relation name */ char *relname; /* relation name */
Oid reloid; /* relation oid */ Oid reloid; /* relation OID */
Oid relfilenode; /* relation relfile node */ Oid relfilenode; /* relation relfile node */
/* relation tablespace path, or "" for the cluster default */ Oid indtable; /* if index, OID of its table, else 0 */
char *tablespace; Oid toastheap; /* if toast table, OID of base table, else 0 */
bool nsp_alloc; char *tablespace; /* tablespace path; "" for cluster default */
bool tblsp_alloc; bool nsp_alloc; /* should nspname be freed? */
bool tblsp_alloc; /* should tablespace be freed? */
} RelInfo; } RelInfo;
typedef struct typedef struct
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment