* Noah Misch (n...@leadboat.com) wrote:
> On Tue, Apr 05, 2016 at 05:50:18PM -0400, Stephen Frost wrote:
> > @@ -14187,18 +14869,65 @@ dumpTable(Archive *fout, TableInfo *tbinfo)
> 
> > +                                                     "FROM 
> > pg_catalog.pg_attribute at "
> > +                                      "JOIN pg_catalog.pg_class c ON 
> > (at.attrelid = c.oid) "
> > +                                                     "LEFT JOIN 
> > pg_init_privs pip ON "
> 
> Since pg_attribute and pg_class require schema qualification here, so does
> pg_init_privs.  Likewise elsewhere in the patch's pg_dump changes.

Attached is a patch to qualify the tables used in that query.  I
reviewed all of the other pg_init_privs uses and they all match the
qualification level of the other tables in those queries.  This isn't
too surprising as this is the only query which happens outside of the
"get*()" functions.

This patch doesn't do anything but qualify the table usage and that
query is checked by the pg_dump regression suite and ran fine for me,
so, if there are no objections, I'll push this later on this afternoon.

Thanks!

Stephen
From b8032e96ad1865a824ea2feb2f2a34f9b29ac6ac Mon Sep 17 00:00:00 2001
From: Stephen Frost <sfr...@snowman.net>
Date: Tue, 10 May 2016 12:55:11 -0400
Subject: [PATCH] Qualify table usage in dumpTable()

All of the other tables used in the query in dumpTable(), which is
collecting column-level ACLs, are qualified, so we should be qualifying
the pg_init_privs and related sub-select against pg_class too.

Pointed out by Noah, patch by me.
---
 src/bin/pg_dump/pg_dump.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 1267afb..4a9b1bf 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -14992,9 +14992,10 @@ dumpTable(Archive *fout, TableInfo *tbinfo)
 							  "%s AS initrattacl "
 							  "FROM pg_catalog.pg_attribute at "
 					   "JOIN pg_catalog.pg_class c ON (at.attrelid = c.oid) "
-							  "LEFT JOIN pg_init_privs pip ON "
+							  "LEFT JOIN pg_catalog.pg_init_privs pip ON "
 							  "(pip.classoid = "
-				 "(SELECT oid FROM pg_class WHERE relname = 'pg_class') AND "
+							  "(SELECT oid FROM pg_catalog.pg_class "
+							  "WHERE relname = 'pg_class') AND "
 				   " at.attrelid = pip.objoid AND at.attnum = pip.objsubid) "
 							  "WHERE at.attrelid = '%u' AND "
 							  "NOT at.attisdropped "
-- 
2.5.0

Attachment: signature.asc
Description: Digital signature

Reply via email to