Re: pg_system_identifier()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Browne <cbbrowne(at)gmail(dot)com>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Vik Fearing <vik(dot)fearing(at)dalibo(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_system_identifier()
Date: 2013-08-23 16:36:31
Message-ID: 23521.1377275791@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christopher Browne <cbbrowne(at)gmail(dot)com> writes:
> On Fri, Aug 23, 2013 at 3:10 AM, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
>> Would it make sense for such identifiers be standard UUID
>> (http://en.wikipedia.org/wiki/UUID)?

> There is sense to this, sure.

That ship's already sailed, though. As was pointed out upthread, we don't
really want to change the way that pg_controldata prints the system ID,
and we don't want this SQL function printing something different either.

> I'd think that constructing a Type 5 (SHA-1) UUID based on some local
> information would make a lot of sense.

> In effect, based on constructing SHA-1 on a string looking like:

> "Database system identifier: 5651554613500795646
> Maximum data alignment: 8
> Database block size: 8192
> WAL block size: 8192
> Maximum length of identifiers: 64
> Date/time type storage: 64-bit integers
> Version: PostgreSQL 9.1.1 on x86_64-unknown-linux-gnu, compiled by
> gcc (Debian 4.6.1-4) 4.6.1, 64-bit"

> ==> SHA-1 of b1b012cc85149d2fe4bf0fc18c38dcf1218e95a5

Including the version string would be a seriously bad idea --- you
don't want the sys ID to change just because you did a minor version
upgrade, or even recompiled the same version with a newer compiler,
do you? There might be some point in factoring in those other values,
but I'm not terribly excited about them either.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2013-08-23 17:30:05 Re: [PATCH] pg_sleep(interval)
Previous Message Christopher Browne 2013-08-23 16:30:03 Re: pg_system_identifier()