Re: pg_system_identifier()

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pg_system_identifier()
Дата
Msg-id 20130917145959.GL5452@awork2.anarazel.de
обсуждение исходный текст
Ответ на Re: pg_system_identifier()  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: pg_system_identifier()  (Robert Haas <robertmhaas@gmail.com>)
Re: pg_system_identifier()  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: pg_system_identifier()
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: proposal: simple date constructor from numeric values