Re: Bogus tags for comments, ACLs, and security labels in pg_dump

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bogus tags for comments, ACLs, and security labels in pg_dump
Дата
Msg-id 25578.1516577481@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Bogus tags for comments, ACLs, and security labels in pg_dump  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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

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)

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: [HACKERS] Support for Secure Transport SSL library on macOS as OpenSSL alternative
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] Support for Secure Transport SSL library on macOS asOpenSSL alternative