Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g4gge-0001MH-4N for pgsql-general@arkaria.postgresql.org; Tue, 25 Sep 2018 06:19:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g4ggc-0004d5-1Z for pgsql-general@arkaria.postgresql.org; Tue, 25 Sep 2018 06:19:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g4ggb-0004ce-FM for pgsql-general@lists.postgresql.org; Tue, 25 Sep 2018 06:19:05 +0000 Received: from mail.alteeve.ca ([65.39.153.71] helo=zimbra.alteeve.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g4ggQ-000258-SG for pgsql-general@lists.postgresql.org; Tue, 25 Sep 2018 06:19:01 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.alteeve.com (Postfix) with ESMTP id A595ABFAF9F; Tue, 25 Sep 2018 02:18:48 -0400 (EDT) Received: from zimbra.alteeve.com ([127.0.0.1]) by localhost (zimbra.alteeve.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id WT2bwVXEbcFZ; Tue, 25 Sep 2018 02:18:48 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.alteeve.com (Postfix) with ESMTP id 3FCDEBFAF9C; Tue, 25 Sep 2018 02:18:48 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra.alteeve.com 3FCDEBFAF9C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alteeve.ca; s=3658BF78-91B3-11E8-A999-AEFD2914AE28; t=1537856328; bh=IkMFRPUT6bHEKcJ52iQvU5dPiOs8AluVWx6kdaLv5pw=; h=To:From:Message-ID:Date:MIME-Version; b=h2f0OVQ6REgCpydhnbBtkiScJUHrI3SVeQmqhmMHupQg77FJswtX29InN8y2SRdXf BJIZCSMVdywIk4kqtzei+kIbq8F+wtcl6xVx3r534J/IocFUrEuf3LJYN2XMoGYvtM PL95dO+Xi7hJHclh8bQzv62KaacI+kvKL6gGLUjZpWqNlC6rmSIdmN0nwL8kBaPg+v ua46nqBmzH+SZ9u4jyVnOBIDuVUw1psIWYcp+busCNOo7Wj4Ccs6Bro817lT+8Pxsy JhQft9KAQ12PTwIIYiUgXwCds3AgBvA3Vd6jdwp0TX0qK/o+btCVssPpEz6oEb/hbo p+Vlxzs24HuFA== X-Virus-Scanned: amavisd-new at zimbra.alteeve.com Received: from zimbra.alteeve.com ([127.0.0.1]) by localhost (zimbra.alteeve.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6MF9lK6UrPTA; Tue, 25 Sep 2018 02:18:48 -0400 (EDT) Received: from neutron.alteeve.com (072-185-148-175.res.spectrum.com [72.185.148.175]) by zimbra.alteeve.com (Postfix) with ESMTPSA id EAFB9BFAF9E; Tue, 25 Sep 2018 02:18:47 -0400 (EDT) Subject: Re: Weird procedure question To: James Keener Cc: "pgsql-generallists.postgresql.org" References: <95e561cf-c098-4648-0ec5-030b47c995ba@alteeve.ca> From: digimer Message-ID: <50b1e369-587c-e73a-1382-e56da6c3abdd@alteeve.ca> Date: Tue, 25 Sep 2018 02:18:48 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------2F09315E8383836F9711CE15" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------2F09315E8383836F9711CE15 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Oooooh, this is a very interesting approach! I didn't realize any UUIDs=20 could be created in a predictable way. Thank you, this might be what I ne= ed. 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=20 > as "null" and is set on the first update, and all subsequent updates,=20 > 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 > 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=E2=84=A2. > > Jim > > On Tue, Sep 25, 2018 at 1:38 AM digimer > 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 > --------------2F09315E8383836F9711CE15 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

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 <= ;ji= m@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=E2=84=A2.

Jim

On Tue, Sep 25, 2018 at 1:38 AM digimer <= lists@alteeve.ca> wrote:<= br>
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

--------------2F09315E8383836F9711CE15--