Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YdPdB-0005cO-AE for pgsql-docs@arkaria.postgresql.org; Wed, 01 Apr 2015 20:52:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YdPdA-0001Qz-AD for pgsql-docs@arkaria.postgresql.org; Wed, 01 Apr 2015 20:52:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YdPd9-0001Qs-CX for pgsql-docs@postgresql.org; Wed, 01 Apr 2015 20:52:55 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YdPd4-0007z2-HJ for pgsql-docs@postgresql.org; Wed, 01 Apr 2015 20:52:53 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1YdPd2-00056n-Bo; Wed, 01 Apr 2015 16:52:48 -0400 Date: Wed, 1 Apr 2015 16:52:48 -0400 From: Bruce Momjian To: David Johnston Cc: "pgsql-docs@postgresql.org" Subject: Re: libpq "service" parameter not documented as not allowed inside a pg_service file Message-ID: <20150401205248.GB13005@momjian.us> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="tKW2IUtsqtDRztdT" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org --tKW2IUtsqtDRztdT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Dec 19, 2014 at 06:52:42PM -0700, David Johnston wrote: > While the fact that you cannot do: > > [service_template] > host=xxx.xxx.xxx.xxx > > [service_db1] > dbname=db1 > service=service_template > > seems obvious there is nothing in the documentation that says this is > prohibited; and attempting a simple alias entry: I have developed the attached patch to warn users that nesting of service entries is not supported. I prefer code warnings over documentation because the user gets the warning as soon as they try something, rather than having to hunt in the documentation. I don't think this issue has come up enough to warrant a doc mention too though. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + --tKW2IUtsqtDRztdT Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pg_service.diff" diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c new file mode 100644 index e2a06b3..083e6df *** a/src/interfaces/libpq/fe-connect.c --- b/src/interfaces/libpq/fe-connect.c *************** parseServiceFile(const char *serviceFile *** 4061,4066 **** --- 4061,4076 ---- } *val++ = '\0'; + if (strcmp(key, "service") == 0) + { + printfPQExpBuffer(errorMessage, + libpq_gettext("nested service specifications not supported in service file \"%s\", line %d\n"), + serviceFile, + linenr); + fclose(f); + return 3; + } + /* * Set the parameter --- but don't override any previous * explicit setting. --tKW2IUtsqtDRztdT Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs --tKW2IUtsqtDRztdT--