pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bossart, Nathan <bossartn@amazon.com>
To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #15788: 'pg_dump --create' orders database GRANTs incorrectly
Date: Wed, 1 May 2019 23:28:03 +0000
Message-ID: <9C9271CF-9A7A-45AE-B034-1246A93788C9@amazon.com> (raw)
In-Reply-To: <15788-4e18847520ebcc75@postgresql.org>
References: <15788-4e18847520ebcc75@postgresql.org>

It looks like the bug reporting form destroyed the patch.  I've
attached it again here.

Nathan




Attachments:

  [application/octet-stream] v1-0001-Fix-ordering-of-GRANTs-for-databases-in-pg_dump.patch (2.0K, ../9C9271CF-9A7A-45AE-B034-1246A93788C9@amazon.com/2-v1-0001-Fix-ordering-of-GRANTs-for-databases-in-pg_dump.patch)
  download | inline diff:
From 710647c541514ded39adbc8b100b53d0a0378407 Mon Sep 17 00:00:00 2001
From: Nathan Bossart <bossartn@amazon.com>
Date: Wed, 1 May 2019 23:04:04 +0000
Subject: [PATCH v1 1/1] Fix ordering of GRANTs for databases in pg_dump.

---
 src/bin/pg_dump/pg_dump.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index db8ca40a78..28e78756a8 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -2672,13 +2672,23 @@ dumpDatabase(Archive *fout)
 						  "(%s datdba) AS dba, "
 						  "pg_encoding_to_char(encoding) AS encoding, "
 						  "datcollate, datctype, datfrozenxid, datminmxid, "
-						  "(SELECT array_agg(acl ORDER BY acl::text COLLATE \"C\") FROM ( "
-						  "  SELECT unnest(coalesce(datacl,acldefault('d',datdba))) AS acl "
-						  "  EXCEPT SELECT unnest(acldefault('d',datdba))) as datacls)"
+						  "(SELECT array_agg(acl ORDER BY row_n) FROM "
+						  "(SELECT acl, row_n FROM "
+						  "unnest(coalesce(datacl,acldefault('d',datdba))) "
+						  "WITH ORDINALITY AS perm(acl,row_n) "
+						  "WHERE NOT EXISTS ( "
+						  "SELECT 1 FROM "
+						  "unnest(acldefault('d',datdba)) "
+						  "AS init(init_acl) WHERE acl = init_acl)) as datacls)"
 						  " AS datacl, "
-						  "(SELECT array_agg(acl ORDER BY acl::text COLLATE \"C\") FROM ( "
-						  "  SELECT unnest(acldefault('d',datdba)) AS acl "
-						  "  EXCEPT SELECT unnest(coalesce(datacl,acldefault('d',datdba)))) as rdatacls)"
+						  "(SELECT array_agg(acl ORDER BY row_n) FROM "
+						  "(SELECT acl, row_n FROM "
+						  "unnest(acldefault('d',datdba)) "
+						  "WITH ORDINALITY AS initp(acl,row_n) "
+						  "WHERE NOT EXISTS ( "
+						  "SELECT 1 FROM "
+						  "unnest(coalesce(datacl,acldefault('d',datdba))) "
+						  "AS permp(orig_acl) WHERE acl = orig_acl)) as rdatacls)"
 						  " AS rdatacl, "
 						  "datistemplate, datconnlimit, "
 						  "(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, "
-- 
2.16.5



view thread (10+ messages)  latest in thread

Message-ID: <9C9271CF-9A7A-45AE-B034-1246A93788C9@amazon.com>
Permalink:  ../9C9271CF-9A7A-45AE-B034-1246A93788C9@amazon.com/
Also on:    postgresql.org/message-id/9C9271CF-9A7A-45AE-B034-1246A93788C9@amazon.com

 ·  · 

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-bugs@postgresql.org
  Cc: bossartn@amazon.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15788: 'pg_dump --create' orders database GRANTs incorrectly
  In-Reply-To: <9C9271CF-9A7A-45AE-B034-1246A93788C9@amazon.com>

* 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