Re: pg_dump dump catalog ACLs

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Jose Luis Tallon <jltallon(at)adv-solutions(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump dump catalog ACLs
Date: 2016-05-10 17:43:33
Message-ID: 20160510174333.GA554972@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephen Frost wrote:

> 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 "

The subquery comparing the OID of pg_class using only a condition on
relname seems wrong; wouldn't it fail or produce wrong results if
somebody creates a table named pg_class in another schema? I think you
should write the comparison like this instead:
classoid = 'pg_catalog.pg_class'::regclass

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2016-05-10 17:47:05 Re: pg_dump dump catalog ACLs
Previous Message Robert Haas 2016-05-10 17:42:15 Re: HeapTupleSatisfiesToast() busted? (was atomic pin/unpin causing errors)