Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VLwlF-00008M-Ib for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Sep 2013 15:00:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VLwlF-000376-2C for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Sep 2013 15:00:17 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VLwlD-00036e-Q4 for pgsql-hackers@postgresql.org; Tue, 17 Sep 2013 15:00:16 +0000 Received: from moutng.kundenserver.de ([212.227.17.9]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VLwlA-0002W1-Bw for pgsql-hackers@postgresql.org; Tue, 17 Sep 2013 15:00:14 +0000 Received: from anarazel.de (p5DDC4CBE.dip0.t-ipconnect.de [93.220.76.190]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MbtgI-1Vf7VG10kg-00JcB8; Tue, 17 Sep 2013 17:00:00 +0200 Received: by anarazel.de (Postfix, from userid 1000) id 98F44100D8A; Tue, 17 Sep 2013 16:59:59 +0200 (CEST) Date: Tue, 17 Sep 2013 16:59:59 +0200 From: Andres Freund To: Robert Haas Cc: Satoshi Nagayasu , Tom Lane , Josh Berkus , Fujii Masao , Michael Paquier , Jim Nasby , Greg Stark , Hannu Krosing , Alvaro Herrera , PostgreSQL-development Subject: Re: pg_system_identifier() Message-ID: <20130917145959.GL5452@awork2.anarazel.de> References: <521A8985.2040509@nasby.net> <521B8C1E.9000808@agliodbs.com> <20130826184546.GB5464@awork2.anarazel.de> <15419.1377549357@sss.pgh.pa.us> <52369651.7000208@uptime.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Provags-ID: V02:K0:r8LPBBhYy+aDR0aRlC1DlYGNfljkl/iH4oLCXoLUvFN ACn1Wv9s2n6ec7dYhEWKh7bxa3UYJPxJgjgRD2SNMiWFG3/N1+ H6X/8f5PmLtvx2tCNF+fCaruiRERocEIAw9/CRuHmVHkLnKJUI 6AWBnfFKogTTjU2bpyph/kGROCrJHHgA6lofD3IZx2SGg21Avf Mvyxb7Cda/j2g+mnVRjBaDenre3GizAshZ+4zlARa7WF/5padV hl4R+l1YlRuZg8l7lPmV3i4YIvwPwNsItqrxo1pqVhxNirehd6 Czj9amXk2V2lJXhGtw69M3kADTags1iH/3kSOiWbyknP+IxyrL b8FayQNWEk/ukbB+Cf5sYhvFiwWYNivz5rGs1Ljy3 X-Pg-Spam-Score: 1.7 (+) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2013-09-17 10:57:46 -0400, Robert Haas wrote: > On Mon, Sep 16, 2013 at 1:25 AM, Satoshi Nagayasu wrote: > > How about adding new system view with new function which returns > > a single pg_controldata value in text type, and using a cast for > > each column in the view definition? > > > > CREATE VIEW pg_catalog.pg_controldata AS > > SELECT pg_controldata('control_version')::integer AS control_version, > > pg_controldata('catalog_version')::integer AS catalog_version, > > pg_controldata('system_identifier')::bigint AS system_identifier, > > ... > > pg_controldata('next_xlog_file')::char(25) AS next_xlog_file, > > ... > > pg_controldata('encoding')::text AS encoding; > > > > Given that the view can work like a SRF, and it allows us to retrieve > > all the values of pg_controldata with appropriate types in single > > record from the view: > > I like this idea. I think having an easy way to get the values with > the right types will be a plus. But adding a separate function for > each field seems excessive, so I think this is a good compromise. Why not add a single function returning a composite type then? That'd at least have a chance of returning consistent values for the individual values that change during runtime. It would also produce proper errors when you load a view using columns that don't exist anymore instead of just at runtime. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers