Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 516E1B5DC1A for ; Fri, 14 Oct 2011 22:25:23 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 35987-04 for ; Sat, 15 Oct 2011 01:25:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from mail-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by mail.postgresql.org (Postfix) with ESMTP id A246CB5DC1C for ; Fri, 14 Oct 2011 22:25:16 -0300 (ADT) Received: by pzk4 with SMTP id 4so3412393pzk.3 for ; Fri, 14 Oct 2011 18:25:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:content-type; bh=ZZLM/gkl5FsK1jAE5K7GGDFL1gI3mZKLR3xkmOqNuaE=; b=MesO/HA81QOm+i4m3Dnq6RUdTQMXKuP+Tt39AYXSqUTKeur8x4gOngY1N9YzPeNGer 2b0PewDwEUI2w82rpaHfL/lPrSrszBKJlJDig789ItWjtkSVar/QGN7hzCBeZ5d/eVky A6mcgh554gwyFJCSsXgkRE8a2H9icTmMIF6S4= Received: by 10.68.29.199 with SMTP id m7mr20168597pbh.112.1318641916388; Fri, 14 Oct 2011 18:25:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.53.13 with HTTP; Fri, 14 Oct 2011 18:24:46 -0700 (PDT) From: Thom Brown Date: Sat, 15 Oct 2011 02:24:46 +0100 X-Google-Sender-Auth: ba9VSvciJaPL3giArfVdxfN1BsQ Message-ID: Subject: PGDATA confusion To: pgsql-docs Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001 X-Spam-Level: X-Archive-Number: 201110/47 X-Sequence-Number: 7047 Hi, I notice that in the man page and the page for pg_ctl in the documentation (http://www.postgresql.org/docs/current/static/app-pg-ctl.html) it states that the -D parameter should point to the directory which contains the database files: "Specifies the file system location of the database files. If this is omitted, the environment variable PGDATA is used." This isn't necessarily true. It will only need to know where the postgresql.conf file is. In Debian and Ubuntu, for example, the "database files" reside in /var/lib/postgresql/x.x/main/, and the configuration files in /etc/postgresql/x.x/main/, so a user might assume they need to point it to the former as that's where the actual database itself can be found, when in fact it needs to be the latter. This same inaccuracy affects the "postgres" command (http://www.postgresql.org/docs/current/static/app-postgres.html) to a lesser extent: "Specifies the file system location of the data directory or configuration file(s)." Which is it? This suggests it can be either, when only the latter matters. If it also happens to be the data directory, that's unimportant. To add further confusion, the page describing PGDATA (http://www.postgresql.org/docs/current/static/storage-file-layout.html) refers to it like so: "All the data needed for a database cluster is stored within the cluster's data directory, commonly referred to as PGDATA... *snip* The PGDATA directory contains several subdirectories and control files... ...In addition to these required items, the cluster configuration files postgresql.conf, pg_hba.conf, and pg_ident.conf are traditionally stored in PGDATA (although in PostgreSQL 8.0 and later, it is possible to keep them elsewhere)." Traditionally but not necessarily, and not by default in Debian and Ubuntu. In fact Gentoo (and therefore probably Sabayon too) has also elected for this separation of data files and config files as of 9.0. So if one set PGDATA to somewhere which had no database files at all, but just postgresql.conf, it could still work (assuming it, in turn, set data_directory correctly), but not vice versa. It would make more sense to call it PGCONFIG, although I'm not proposing that, especially since PGDATA makes sense when it comes to initdb. There are probably plenty of other places in the docs which also don't adequately describe PGDATA or -D. Any disagreements? If not, should I write a patch (since someone will probably accuse me of volunteering anyway) or would someone like to commit some adjustments? -- Thom Brown Twitter: @darkixion IRC (freenode): dark_ixion Registered Linux user: #516935 EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company