Re: Accessing pg_controldata information from SQL

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Massa, Harald Armin" <chef(at)ghum(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Accessing pg_controldata information from SQL
Date: 2009-06-04 04:01:08
Message-ID: 200906040401.n54418522885@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Massa, Harald Armin wrote:
> Hello Bruce,
>
> I am specifically looking for the "Datenbanksystemidentifikation" , that
> would be "database system identification" - the rather unique ID of a
> database installation. Third line in pg_controldata output:
>
>
> pg_control-Versionsnummer: 833
> Katalogversionsnummer: 200711281
> ----------------------------------------------------------------------------------------------
> Datenbanksystemidentifikation: 5293702538224708457
> ----------------------------------------------------------------------------------------------
> Datenbank-Cluster-Status: im Produktionsmodus
> pg_control zuletzt ge?ndert: 02.06.2009 10:54:27
>

Ah, good point. I don't see any SQL API for access to that value. The
value is used to make sure the xlogs match the server, and pg_resetxlog
will change that identifier. The value is generated from the
time-of-day that xlog is initialized at bootstrap time:

gettimeofday(&tv, NULL);
sysidentifier = ((uint64) tv.tv_sec) << 32;
sysidentifier |= (uint32) (tv.tv_sec | tv.tv_usec);

I am afraid the setting isn't as unique as you probably want.

Why do you want the value and can we provide a better value for you?

---------------------------------------------------------------------------

>
> Best wishes,
>
> Harald
>
>
> On Tue, Jun 2, 2009 at 4:19 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>
> > Massa, Harald Armin wrote:
> > > Hello,
> > >
> > > is there any way to acess the pg_controldata information via SQL?
> > >
> > > (running pg_controldata via shell needs file access to the postgresql
> > data
> > > dictionary, which is usually not given)
> >
> > Some of the settings have read-only variables that appear in SHOW ALL or
> > the pg_settings tables, or SELECT version(). Is there something
> > specific you are looking for that doesn't appear there?
> >
> > --
> > Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> > EnterpriseDB http://enterprisedb.com
> >
> > + If your life is a hard drive, Christ can be your backup. +
> >
>
>
>
> --
> GHUM Harald Massa
> persuadere et programmare
> Harald Armin Massa
> Spielberger Stra?e 49
> 70435 Stuttgart
> 0173/9409607
> no fx, no carrier pigeon
> -
> LASIK good, steroids bad?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2009-06-04 05:32:09 Re: problem with FOUND and EXECUTE in pl/pgsql
Previous Message Scott Marlowe 2009-06-04 03:13:50 Re: High I/O writes activity on disks causing images on browser to lag and not load