pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: digimer <lists@alteeve.ca>
To: James Keener <jim@jimkeener.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Weird procedure question
Date: Tue, 25 Sep 2018 02:18:48 -0400
Message-ID: <50b1e369-587c-e73a-1382-e56da6c3abdd@alteeve.ca> (raw)
In-Reply-To: <CAG8g3ty0hjVd+74hjFJVD0o3a8PCuPRL3Dg=xOfkv5Lcmu_pPQ@mail.gmail.com>
References: <95e561cf-c098-4648-0ec5-030b47c995ba@alteeve.ca>
	<a196d4f8-0011-c6d2-12f7-82e258bb64eb@alteeve.ca>
	<CAG8g3tzyWi_Je1TBohK=x=_MUd391BCsBOo=W48mxdvUbw=DyA@mail.gmail.com>
	<cf63c1e5-671a-7f7f-2411-8eef964c3a33@alteeve.ca>
	<CAG8g3tzZA1my8f-0jyW5rJayS3pDdZ0PsPao2TRviAJ2S27xVw@mail.gmail.com>
	<CAG8g3ty0hjVd+74hjFJVD0o3a8PCuPRL3Dg=xOfkv5Lcmu_pPQ@mail.gmail.com>

Oooooh, this is a very interesting approach! I didn't realize any UUIDs 
could be created in a predictable way. Thank you, this might be what I need.

digimer

On 2018-09-25 1:47 a.m., James Keener wrote:
> Also, modified time doesn't need to be the current time, if it starts 
> as "null" and is set on the first update, and all subsequent updates, 
> the pre-update modified time could be used to help key the history pk.
>
> Jim
>
> On Tue, Sep 25, 2018 at 1:45 AM James Keener <jim@jimkeener.com 
> <mailto:jim@jimkeener.com>> wrote:
>
>     v3 UUIDs are basically MD5 hashes (v5 is sha1?). So for the same
>     input you'll always get the same hash.
>
>     I had assumed the modified time would be the same; if that's not,
>     then I'm not sure and my gut tells me this becomes A Really Hard
>     Problemâ„¢.
>
>     Jim
>
>     On Tue, Sep 25, 2018 at 1:38 AM digimer <lists@alteeve.ca
>     <mailto:lists@alteeve.ca>> wrote:
>
>         On 2018-09-25 1:33 a.m., James Keener wrote:
>         > Do you need a single field for the pk or can you just make
>         it the
>         > (original_table_pk, modified_time)? Alternatively, you could
>         generate
>         > a uuid v3 from the (original_table_pk, modified_time) using
>         something
>         > like uuid_generate_v3(uuid_nil(), original_table_pk || ":" ||
>         > modified_time)?
>
>         I need to preset the modified_time, I can't use now() or else
>         the value
>         would differ between databases. Also, unless I am missing
>         something,
>         uuid_generate_v3() would generate a different UUID per trigger
>         of the
>         procedure, so I'd end up with different history_uuids on each
>         database
>         that I ran the query against.
>
>         If I am missing something (and entirely possible I am), please
>         hit me
>         with a clue stick. :)
>
>         digimer
>

view thread (11+ messages)  latest in thread

Message-ID: <50b1e369-587c-e73a-1382-e56da6c3abdd@alteeve.ca>
Permalink:  ../50b1e369-587c-e73a-1382-e56da6c3abdd@alteeve.ca/
Also on:    postgresql.org/message-id/50b1e369-587c-e73a-1382-e56da6c3abdd@alteeve.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: lists@alteeve.ca, jim@jimkeener.com
  Subject: Re: Weird procedure question
  In-Reply-To: <50b1e369-587c-e73a-1382-e56da6c3abdd@alteeve.ca>
  References: <95e561cf-c098-4648-0ec5-030b47c995ba@alteeve.ca> <a196d4f8-0011-c6d2-12f7-82e258bb64eb@alteeve.ca> <CAG8g3tzyWi_Je1TBohK=x=_MUd391BCsBOo=W48mxdvUbw=DyA@mail.gmail.com> <cf63c1e5-671a-7f7f-2411-8eef964c3a33@alteeve.ca> <CAG8g3tzZA1my8f-0jyW5rJayS3pDdZ0PsPao2TRviAJ2S27xVw@mail.gmail.com> <CAG8g3ty0hjVd+74hjFJVD0o3a8PCuPRL3Dg=xOfkv5Lcmu_pPQ@mail.gmail.com> <50b1e369-587c-e73a-1382-e56da6c3abdd@alteeve.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox