Re: Accessing pg_controldata information from SQL

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

Bruce,

> would be "database system identification" - the rather unique ID of a

> > database installation. Third line in pg_controldata output:
> >
> ----------------------------------------------------------------------------------------------
> > Datenbanksystemidentifikation: 5293702538224708457
> >
> ----------------------------------------------------------------------------------------------
> 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?
>
> I have a central PostgreSQL installation. In addiotion PostgreSQL is
installed on laptops. Those laptops are SOMETIMES connected to the central
database.
The databases on those laptops are (to some extend) replications of the
central PostgreSQL database.

Now I have to keep track of information like "Laptop xxx allready got the
changes xxx"; esp. with DML-changes which get replicated.
Challenge is to identify the entity "Laptop"... actually I have one table
named "dbidentity", which gets populated with a GUID, and use this to mark
the databases. Which has some potential for misstakes... so I am looking for
something "hard-coded" into PostgreSQL to really identify two different
databases (with rather the same content) via a single marker.

So probably this identifier also gets resetted on pg_resetlxlog, and is not
really what I would need :( (on the other hand: that system is running since
5 years on different machines an pg_resetxlog was not used one time :) )

Thanks for caring,

Harald

--
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?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yoshinori Sano 2009-06-04 07:42:40 Simple, safe hot backup and recovery
Previous Message youngvonlee@gmail.com 2009-06-04 05:52:58 postgresql source code is worth to read