Re: Accessing pg_controldata information from SQL

Поиск
Список
Период
Сортировка
От Massa, Harald Armin
Тема Re: Accessing pg_controldata information from SQL
Дата
Msg-id e3e180dc0906032359k6c8fe41chf9b16ed1672c5fa0@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Accessing pg_controldata information from SQL  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: Accessing pg_controldata information from SQL  (Bruce Momjian <bruce@momjian.us>)
Список 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?

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: problem with FOUND and EXECUTE in pl/pgsql
Следующее
От: Yoshinori Sano
Дата:
Сообщение: Simple, safe hot backup and recovery