Обсуждение: uuid for each postgres install?

Поиск
Список
Период
Сортировка

uuid for each postgres install?

От
Gerardo Herzig
Дата:
Hi all. Im wondering if there is, maybe at compilation time, some sort of unique identifier who identifies the actual
installation.

It would be even  better if can be accesed in SQL form.
At "initdb" time would be accepted, too.


Thanks!

Gerardo



Re: uuid for each postgres install?

От
Adrian Klaver
Дата:
On 09/25/2014 01:02 PM, Gerardo Herzig wrote:
> Hi all. Im wondering if there is, maybe at compilation time, some sort of unique identifier who identifies the actual
installation.
>
> It would be even  better if can be accesed in SQL form.
> At "initdb" time would be accepted, too.

initdb does create a Database system identifier which can seen using 
pg_controldata:

postgres@killi:~> pg_controldata  /usr/local/pgsql/data
pg_control version number:            903
Catalog version number:               201008051
Database system identifier:           5861256043884404217
Database cluster state:               shut down

A quick search showed that folks would like an SQL way of getting this 
and that none is available as far as I can determine. The only solution 
I could find was grepping the pg_controldata output.

>
>
> Thanks!
>
> Gerardo
>
>


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: uuid for each postgres install?

От
Gerardo Herzig
Дата:
Well, thats are good news. At least its a good starting point.
Thanks Adrian!

Gerardo

----- Mensaje original -----
> De: "Adrian Klaver" <adrian.klaver@aklaver.com>
> Para: pgsql-sql@postgresql.org
> Enviados: Jueves, 25 de Septiembre 2014 17:18:17
> Asunto: Re: [SQL] uuid for each postgres install?
> 
> On 09/25/2014 01:02 PM, Gerardo Herzig wrote:
> > Hi all. Im wondering if there is, maybe at compilation time, some
> > sort of unique identifier who identifies the actual installation.
> >
> > It would be even  better if can be accesed in SQL form.
> > At "initdb" time would be accepted, too.
> 
> initdb does create a Database system identifier which can seen using
> pg_controldata:
> 
> postgres@killi:~> pg_controldata  /usr/local/pgsql/data
> pg_control version number:            903
> Catalog version number:               201008051
> Database system identifier:           5861256043884404217
> Database cluster state:               shut down
> 
> A quick search showed that folks would like an SQL way of getting
> this
> and that none is available as far as I can determine. The only
> solution
> I could find was grepping the pg_controldata output.
> 
> >
> >
> > Thanks!
> >
> > Gerardo
> >
> >
> 
> 
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
> 
> 
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
> 



Re: uuid for each postgres install?

От
Ian Lawrence Barwick
Дата:
2014-09-26 6:56 GMT+09:00 Gerardo Herzig <gherzig@fmed.uba.ar>:
> ----- Mensaje original -----
>> De: "Adrian Klaver" <adrian.klaver@aklaver.com>
>> Para: pgsql-sql@postgresql.org
>> Enviados: Jueves, 25 de Septiembre 2014 17:18:17
>> Asunto: Re: [SQL] uuid for each postgres install?
>>
>> On 09/25/2014 01:02 PM, Gerardo Herzig wrote:
>> > Hi all. Im wondering if there is, maybe at compilation time, some
>> > sort of unique identifier who identifies the actual installation.
>> >
>> > It would be even  better if can be accesed in SQL form.
>> > At "initdb" time would be accepted, too.
>>
>> initdb does create a Database system identifier which can seen using
>> pg_controldata:
>>
>> postgres@killi:~> pg_controldata  /usr/local/pgsql/data
>> pg_control version number:            903
>> Catalog version number:               201008051
>> Database system identifier:           5861256043884404217
>> Database cluster state:               shut down
>>
>> A quick search showed that folks would like an SQL way of getting this
>> and that none is available as far as I can determine. The only solution
>> I could find was grepping the pg_controldata output.
>
> Well, thats are good news. At least its a good starting point.
> Thanks Adrian!

Please note that the database system identifier is generated based on the
point in time when initdb was run and is *not* guaranteed to be unique;
in the source it's described as a "hopefully-unique system identifier code" [1].
The "uniqueness" has been improved somewhat for 9.4 but as the commit
message notes, "this is still hardly guaranteed-universally-unique" [2].

[1]
http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/access/transam/xlog.c;h=46eef5f21bab2bb9cb59ee9f6388c9059bb5499a;hb=HEAD
- see function BootStrapXLOG()
[2] http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=5035701e07e8bd395aa878465a102afd7b74e8c3

Regards

Ian Barwick

PS please don't top-post, it makes people grumpy and the thread harder to read.

-- Ian Barwick                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services