Re: SQL command to edit postgresql.conf, with comments - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: SQL command to edit postgresql.conf, with comments
Date
Msg-id 4CB4DAF9.3090504@agliodbs.com
Whole thread Raw
In response to Re: SQL command to edit postgresql.conf, with comments  (Darren Duncan <darren@darrenduncan.net>)
Responses Re: SQL command to edit postgresql.conf, with comments  (Darren Duncan <darren@darrenduncan.net>)
List pgsql-hackers
Darren, All,

> All you would need is for the file parser to retain the
> comments as metadata, include them in the relations that the SQL
> commands see where the latter can also edit them as data, and then write
> out the updated file with comments.

"All you need to do" in order to trisect and angle is to divide it into
three equal parts using just a compass and straightedge.

Given the number of different ways people can comment up pg.conf files,
and the fact that they can have the same settings set multiple times in
the file, both commented and uncommented, and that both the settings and
the comments can be in any order, with user-created spacing, you've
added a *huge* burden of parsing code to any .conf updater.  One which
would, in terms of LOC, exceed the updating code by more than 300%.

>  The fact that Postgres already
> explicitly supports comment metadata in its system catalog means it must
> already know something about this.

We support what?

The solution to this is simple, and was previously discussed on this list:

(a) have a postgresql.conf.auto
(b) add a default include for postgresql.conf.auto at the beginning of
PostgreSQL.conf
(c) SQL updates go to postgresql.conf.auto, which consists only of
"setting = value" in alphabetical order.
(d) We document that settings which are changed manually in
postgresql.conf will override postgresql.conf.auto.
(e) $$profit$$!!

--Josh Berkus

--                                  -- Josh Berkus                                    PostgreSQL Experts Inc.
                        http://www.pgexperts.com
 


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: SQL command to edit postgresql.conf, with comments
Next
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] Text search parser's treatment of URLs and emails