On Fri, May 26, 2017 at 7:47 AM, Stephen Frost <sfr...@snowman.net> wrote:
> Greetings, > > * Robins Tharakan (thara...@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. > It 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.