pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Subject: Re: Bogus tags for comments, ACLs, and security labels in pg_dump
Date: Sun, 21 Jan 2018 18:31:21 -0500
Message-ID: <25578.1516577481@sss.pgh.pa.us> (raw)
In-Reply-To: <21714.1516553459@sss.pgh.pa.us>
References: <21714.1516553459@sss.pgh.pa.us>

I wrote:
> What I think we should do is fix pg_dump so that these classes of
> TOC entries do indeed have tags that meet the expectation held by
> _tocEntryRequired, as per the first attached patch.

Some further poking around identified another place that was taking
dubious shortcuts to identify large-object TOC entries, further down
in _tocEntryRequired.  Since that code is executed only during
binary upgrade, which will be working from a schema-only dump anyway,
it *might* be harmless.  But I'm not sure, and it's certainly far from
future-proof.  I also noted a copy-and-pasteo in dumpSecLabel.

Hence, I intend to add the attached to the back-patched fix proposed
previously.

			regards, tom lane

Attachments:

more-large-object-fixes.patch (text/x-diff, 2.3K) download diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 41741ae..acef20f 100644 *** a/src/bin/pg_dump/pg_backup_archiver.c --- b/src/bin/pg_dump/pg_backup_archiver.c *************** _tocEntryRequired(TocEntry *te, teSectio *** 2944,2957 **** if (ropt->schemaOnly) { /* * In binary-upgrade mode, even with schema-only set, we do not mask * out large objects. Only large object definitions, comments and * other information should be generated in binary-upgrade mode (not * the actual data). */ if (!(ropt->sequence_data && strcmp(te->desc, "SEQUENCE SET") == 0) && ! !(ropt->binary_upgrade && strcmp(te->desc, "BLOB") == 0) && ! !(ropt->binary_upgrade && strncmp(te->tag, "LARGE OBJECT ", 13) == 0)) res = res & REQ_SCHEMA; } --- 2944,2965 ---- if (ropt->schemaOnly) { /* + * The sequence_data option overrides schema-only for SEQUENCE SET. + * * In binary-upgrade mode, even with schema-only set, we do not mask * out large objects. Only large object definitions, comments and * other information should be generated in binary-upgrade mode (not * the actual data). */ if (!(ropt->sequence_data && strcmp(te->desc, "SEQUENCE SET") == 0) && ! !(ropt->binary_upgrade && ! (strcmp(te->desc, "BLOB") == 0 || ! (strcmp(te->desc, "ACL") == 0 && ! strncmp(te->tag, "LARGE OBJECT ", 13) == 0) || ! (strcmp(te->desc, "COMMENT") == 0 && ! strncmp(te->tag, "LARGE OBJECT ", 13) == 0) || ! (strcmp(te->desc, "SECURITY LABEL") == 0 && ! strncmp(te->tag, "LARGE OBJECT ", 13) == 0)))) res = res & REQ_SCHEMA; } diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 0bdd398..8e5e2d5 100644 *** a/src/bin/pg_dump/pg_dump.c --- b/src/bin/pg_dump/pg_dump.c *************** dumpSecLabel(Archive *fout, const char * *** 14811,14817 **** if (dopt->no_security_labels) return; ! /* Comments are schema not data ... except blob comments are data */ if (strncmp(target, "LARGE OBJECT ", 13) != 0) { if (dopt->dataOnly) --- 14811,14817 ---- if (dopt->no_security_labels) return; ! /* Security labels are schema not data ... except blob labels are data */ if (strncmp(target, "LARGE OBJECT ", 13) != 0) { if (dopt->dataOnly)

view thread (2+ messages)

Message-ID: <25578.1516577481@sss.pgh.pa.us>
Permalink:  ../25578.1516577481@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25578.1516577481@sss.pgh.pa.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
  Subject: Re: Bogus tags for comments, ACLs, and security labels in pg_dump
  In-Reply-To: <25578.1516577481@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox