Обсуждение: createdb feature request

Поиск
Список
Период
Сортировка

createdb feature request

От
Mark Harrison
Дата:
Apache has a nice feature: it creates copies of all the default
configuration files, so that it's easy to diff and see what has
been modified in the config files.

Can this be included in createdb as well?

Thanks,
Mark

Here's a patch:


*** initdb.sh-orig    2004-02-11 11:25:49.000000000 -0800
--- initdb.sh    2004-02-11 11:28:35.000000000 -0800
***************
*** 608,615 ****
--- 608,620 ----
   fi
   cp "$PG_IDENT_SAMPLE" "$PGDATA"/pg_ident.conf          || exit_nicely

+ cp "$PGDATA"/pg_ident.conf "$PGDATA"/pg_ident.conf.default     || exit_nicely
+ cp "$PGDATA"/pg_hba.conf "$PGDATA"/pg_hba.conf.default         || exit_nicely
+ cp "$PGDATA"/postgresql.conf "$PGDATA"/postgresql.conf.default || exit_nicely
   chmod 0600 "$PGDATA"/pg_hba.conf "$PGDATA"/pg_ident.conf \
       "$PGDATA"/postgresql.conf
+ chmod 0600 "$PGDATA"/pg_hba.conf.default "$PGDATA"/pg_ident.conf.default \
+     "$PGDATA"/postgresql.conf.default

   echo "ok"


Re: createdb feature request

От
Bruce Momjian
Дата:
Mark Harrison wrote:
> Apache has a nice feature: it creates copies of all the default
> configuration files, so that it's easy to diff and see what has
> been modified in the config files.
>
> Can this be included in createdb as well?

Uh, the defaults are already in /pgsql/share.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: createdb feature request

От
Richard Huxton
Дата:
On Wednesday 11 February 2004 19:49, Mark Harrison wrote:
> Apache has a nice feature: it creates copies of all the default
> configuration files, so that it's easy to diff and see what has
> been modified in the config files.
>
> Can this be included in createdb as well?

Postfix has a useful utility called "postconf"
  postconf => display all settings
  postconf foo => display setting foo
  postconf -n => display non-standard config settings
Other stuff too, see http://www.postfix.org/postconf.1.html

Standard procedure for problems on the postfix list is to ask for "postconf
-n" output before anything else.
--
  Richard Huxton
  Archonet Ltd

Re: createdb feature request

От
Tom Lane
Дата:
Richard Huxton <dev@archonet.com> writes:
> Postfix has a useful utility called "postconf"
>   postconf => display all settings
>   postconf foo => display setting foo
>   postconf -n => display non-standard config settings
> Other stuff too, see http://www.postfix.org/postconf.1.html

> Standard procedure for problems on the postfix list is to ask for "postconf
> -n" output before anything else.

Hmm.  The SQL-ish way to do this would be

    select name, setting, source from pg_settings
    where setting != default_value;

The compiled-in default value for each GUC variable is available in the
GUC data structure, but pg_settings doesn't currently expose it.
Possibly we should add that.

You can almost do it today with

    select name, setting, source from pg_settings
    where source != 'default';

but this clutters the output a little with values that have been
explicitly set but are still equal to the default.  For instance,
I get

regression=# select name, setting, source from pg_settings
regression-# where source != 'default';
         name          |    setting     |        source
-----------------------+----------------+----------------------
 fsync                 | off            | command line
 lc_collate            | C              | override
 lc_ctype              | C              | override
 lc_messages           | C              | database
 lc_monetary           | C              | database
 lc_numeric            | C              | database
 lc_time               | C              | database
 max_connections       | 100            | configuration file
 server_encoding       | SQL_ASCII      | override
 shared_buffers        | 1000           | configuration file
 tcpip_socket          | on             | command line
 TimeZone              | EST5EDT        | environment variable
 transaction_isolation | read committed | override
 transaction_read_only | off            | override
(14 rows)

Not sure if it's worth any work to shorten that.

            regards, tom lane