Re: [HACKERS] Patch: Add --no-comments to skip COMMENTs with pg_dump - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: [HACKERS] Patch: Add --no-comments to skip COMMENTs with pg_dump
Date
Msg-id CAKFQuwZS8CYmB056C78MAT_JsgDV3hoarVY=Q8AC2Go=C7mrWw@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Patch: Add --no-comments to skip COMMENTs with pg_dump  (Stephen Frost <sfrost@snowman.net>)
Responses Re: [HACKERS] Patch: Add --no-comments to skip COMMENTs with pg_dump  (Stephen Frost <sfrost@snowman.net>)
Re: [HACKERS] Patch: Add --no-comments to skip COMMENTs with pg_dump  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Fri, May 26, 2017 at 7:47 AM, Stephen Frost <sfrost@snowman.net> wrote:
Greetings,

* Robins Tharakan (tharakan@gmail.com) wrote:
> Attached is a patch adds a --no-comments argument to pg_dump to skip
> generation of COMMENT statements when generating a backup. This is crucial
> for non-superusers to restore a database backup in a Single Transaction.
> Currently, this requires one to remove COMMENTs via scripts, which is
> inelegant at best.

Having --no-comments seems generally useful to me, in any case.

I​t smacks of being excessive to me.
CREATE EXTENSION IF NOT EXISTS plpgsql ... COMMENT blah;

​A less verbose way to add comments to objects would be nice but we have an immediate problem that we either need to solve or document a best practice for.

COMMENT IF NOT EXISTS has been brought up but it doesn't actually map to what seems to me is the underlying problem...that people don't want a non-functional (usually...) aspect preventing successful restoration.

COMMENT ON object TRY 'text'  -- i.e., replace the word IS with TRY

If the attempt to comment fails for any reason log a warning (maybe) but otherwise ignore the result and continue on without invoking an error.

One suggestion I've seen is to simply "COMMENT ON EXTENSION plpgsql IS NULL;"  If that works in the scenarios people are currently dealing with then I'd say we should advise that such an action be taken for those whom wish to generate dumps that can be loaded by non-super-users.  If the affected users cannot make that work then maybe we should just remove the comment from the extension.  People can lookup "plpgsql" in the docs easily enough and "PL/pgSQL procedural language" doesn't do anything more than expand the acronym.

David J.

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [HACKERS] Segmentation fault when creating a BRIN, 10beta1
Next
From: Robert Haas
Date:
Subject: Re: [JDBC] [HACKERS] Channel binding support for SCRAM-SHA-256