pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Satoshi Nagayasu <snaga@uptime.jp>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Josh Berkus <josh@agliodbs.com>
Cc: Fujii Masao <masao.fujii@gmail.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Jim Nasby <jim@nasby.net>
Cc: Greg Stark <stark@mit.edu>
Cc: Hannu Krosing <hannu@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: pg_system_identifier()
Date: Tue, 17 Sep 2013 16:59:59 +0200
Message-ID: <20130917145959.GL5452@awork2.anarazel.de> (raw)
In-Reply-To: <CA+TgmoYzaAjFXJZ3MT+XCquL8KB=JkUfYEAGtdsDQOqppp9thg@mail.gmail.com>
References: <CAM-w4HMJc+7OCDUFYD=ChWSp6jxBRPContr3Y2Y3py5swwaxig@mail.gmail.com>
	<521A8985.2040509@nasby.net>
	<CAB7nPqSx+GEROLiCMOYBCDimARQauEe=2TDSZmFEjZYnV6yBKw@mail.gmail.com>
	<CAHGQGwH5K9Dm+td00AE9Gwby92fzOJC4mXcjgerYtq+GqxUZhw@mail.gmail.com>
	<WM!4a186afed707ebaddcd3a5f21382e12ef6a9d1c73e47f0b5fcf94a69469174a622e24aa2d786ae1c7e4e1f07993de908!@asav-1.01.com>
	<521B8C1E.9000808@agliodbs.com>
	<20130826184546.GB5464@awork2.anarazel.de>
	<15419.1377549357@sss.pgh.pa.us>
	<52369651.7000208@uptime.jp>
	<CA+TgmoYzaAjFXJZ3MT+XCquL8KB=JkUfYEAGtdsDQOqppp9thg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 2013-09-17 10:57:46 -0400, Robert Haas wrote:
> On Mon, Sep 16, 2013 at 1:25 AM, Satoshi Nagayasu <snaga@uptime.jp> 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



view thread (43+ messages)  latest in thread

Message-ID: <20130917145959.GL5452@awork2.anarazel.de>
Permalink:  ../20130917145959.GL5452@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20130917145959.GL5452@awork2.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: andres@2ndquadrant.com, robertmhaas@gmail.com, snaga@uptime.jp, tgl@sss.pgh.pa.us, josh@agliodbs.com, masao.fujii@gmail.com, michael.paquier@gmail.com, jim@nasby.net, stark@mit.edu, hannu@2ndquadrant.com, alvherre@2ndquadrant.com
  Subject: Re: pg_system_identifier()
  In-Reply-To: <20130917145959.GL5452@awork2.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox