Re: pg_system_identifier()
От | Pavel Stehule |
---|---|
Тема | Re: pg_system_identifier() |
Дата | |
Msg-id | CAFj8pRBLPsr8YQQkp=58YkqOK4wv0d8x5OE==TkDd+j5ixd_Uw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: pg_system_identifier() (Andres Freund <andres@2ndquadrant.com>) |
Список | pgsql-hackers |
<p dir="ltr"><br /> Dne 17. 9. 2013 17:01 "Andres Freund" <<a href="mailto:andres@2ndquadrant.com">andres@2ndquadrant.com</a>>napsal(a):<br /> ><br /> > On 2013-09-17 10:57:46-0400, Robert Haas wrote:<br /> > > On Mon, Sep 16, 2013 at 1:25 AM, Satoshi Nagayasu <<a href="mailto:snaga@uptime.jp">snaga@uptime.jp</a>>wrote:<br /> > > > How about adding new system view with newfunction which returns<br /> > > > a single pg_controldata value in text type, and using a cast for<br /> >> > each column in the view definition?<br /> > > ><br /> > > > CREATE VIEW pg_catalog.pg_controldataAS<br /> > > > SELECT pg_controldata('control_version')::integer AS control_version,<br/> > > > pg_controldata('catalog_version')::integer AS catalog_version,<br /> > >> pg_controldata('system_identifier')::bigint AS system_identifier,<br /> > > > ...<br/> > > > pg_controldata('next_xlog_file')::char(25) AS next_xlog_file,<br /> > > > ...<br /> > > > pg_controldata('encoding')::text AS encoding;<br /> > > ><br /> > >> Given that the view can work like a SRF, and it allows us to retrieve<br /> > > > all the values of pg_controldatawith appropriate types in single<br /> > > > record from the view:<br /> > ><br /> > >I like this idea. I think having an easy way to get the values with<br /> > > the right types will be a plus. But adding a separate function for<br /> > > each field seems excessive, so I think this is a good compromise.<br/> ><br /> > Why not add a single function returning a composite type then? That'd at<br /> > leasthave a chance of returning consistent values for the individual<br /> > values that change during runtime. It wouldalso produce proper errors<br /> > when you load a view using columns that don't exist anymore instead of<br /> >just at runtime.<br /> ><br /><p dir="ltr">+1<p dir="ltr">Pavel<p dir="ltr">> Greetings,<br /> ><br /> >Andres Freund<br /> ><br /> > --<br /> > Andres Freund <a href="http://www.2ndQuadrant.com/">http://www.2ndQuadrant.com/</a><br/> > PostgreSQL Development, 24x7 Support, Training& Services<br /> ><br /> ><br /> > --<br /> > Sent via pgsql-hackers mailing list (<a href="mailto:pgsql-hackers@postgresql.org">pgsql-hackers@postgresql.org</a>)<br/> > To make changes to your subscription:<br/> > <a href="http://www.postgresql.org/mailpref/pgsql-hackers">http://www.postgresql.org/mailpref/pgsql-hackers</a><br/>
В списке pgsql-hackers по дате отправления: