Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p5QSu-0007tl-KC for pgsql-sql@arkaria.postgresql.org; Wed, 14 Dec 2022 12:02:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p5QSt-00025A-F7 for pgsql-sql@arkaria.postgresql.org; Wed, 14 Dec 2022 12:02:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p5QSs-000251-VA for pgsql-sql@lists.postgresql.org; Wed, 14 Dec 2022 12:02:23 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p5QSl-0004Mz-MQ for pgsql-sql@lists.postgresql.org; Wed, 14 Dec 2022 12:02:21 +0000 Received: by mail-ej1-x62e.google.com with SMTP id fc4so43884871ejc.12 for ; Wed, 14 Dec 2022 04:02:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=reddoc.net; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=FLNO2lUvbeGECEsgczkVCFwrN7wGqvB2IGG8FUvE7dc=; b=Wc9QXiONAHNFx/rir9nNW8K+ncIEqrkqDETNU4zTF86uEEn+9zaDxXR/NjMiGkJIAU 2/t9u8Gr9sG5SKaPxRxWl2TOnajJyaJcpBKMyYaA6dSR0Nt5CYyLJArL2GcYDzqeS77F AKKEA1Ct3nll377AjYjFRZ6hxAkGoU78xuKM8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FLNO2lUvbeGECEsgczkVCFwrN7wGqvB2IGG8FUvE7dc=; b=K1MncLUaOxmMxBrD4m+3OROYH98YbUfJvOrd+J3eoTQgWEPT7U73l3mTvxHPpztyrx 4WC6QKfEQrwIR+d8mNzAT/552wLHrQTsZR3VJGu26J+k4L8wtx4f5DsTXt37whAXVyqc 2WOCOM2vwTQslB4xZ+pmwsC65DXknMLiGNupbvJt9+0OT9R2NacWGjkncQgnCsa0TvSi P3yZr9VpAICymoSmRbteUShTsXHc7cfRKxHiSboV+UtmC3PRTZWNK+CiKi08qBeTtnfj vLw+W7JFnsro/Pe5mSBMRQoyCGDemEc7GQkJFDTxPH5bkXJfNApK8wpslZ0w+KkyPrUh bd1A== X-Gm-Message-State: ANoB5plM7mTB4ybKtzCRPaeOLAzC79zgaxhSoFhQTPhZPsqffAS9MwrI zbbZ5Qm53va/25ShUCMUpC7NhN+hlb0NgPBTxi5DLg== X-Google-Smtp-Source: AA0mqf4b2lWUXQhQeqjnQnqWgnp58OzkdmD0fhXC3/ep6rZyE5byuIT8WuoeFHqS6WkEH0koiN1qo3luTzpEGa9+y0o= X-Received: by 2002:a17:906:2c02:b0:7c0:a4a0:2b7f with SMTP id e2-20020a1709062c0200b007c0a4a02b7fmr29301106ejh.739.1671019333924; Wed, 14 Dec 2022 04:02:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Samed YILDIRIM Date: Wed, 14 Dec 2022 14:02:02 +0200 Message-ID: Subject: Re: Postgresql long transaction support To: Kirmo Uusitalo Cc: pgsql-sql@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000cfd75505efc881fd" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000cfd75505efc881fd Content-Type: text/plain; charset="UTF-8" Hi Kirmo, This is a pretty interesting feature. I'm not sure if I've seen something like that before. I recommend you to check the pg_bitemporal[1] project. It may be useful for you. [1]: https://github.com/hettie-d/pg_bitemporal Best regards. Samed YILDIRIM On Wed, 14 Dec 2022 at 13:55, Kirmo Uusitalo wrote: > Hi, > > I'm looking for a solution for version managed (or long transaction) data > in PostgreSQL (and Oracle). > > This means database objects having different properties in different > versions of the data set. Versions could be organized in tree-like > hierarchy (each versios can have subversions). Objects can even be deleted > in some of the versions of the data. > > I am looking for something which would require minimal change in the > application logic, like > > create table my_obj(id serial primary key,prop_1 text); > > insert into my_obj (prop_1) values ('object 1'); > > insert into my_obj (prop_1) values ('object 2 (to be deleted)'); > > > select * from my_obj; > > 1 object 1 > 2 object 2 (to be deleted) > > create version 'xx'; //this functionality i'm looking for > switch to version 'xx'; //this functionality i'm looking for > > select * from my_obj; //same data as in top version as we haven't changed anything yet > > 1 object 1 > 2 object 2 (to be deleted) > > update my_obj set prop_1='updated in version xx' where id = 1;delete from my_obj where id=2; > > select * from my_obj; > > 1 'updated in version xx' > > switch to version 'top'; //let's go back to top version > > select * from my_obj; //same data as before as we haven't changed posted > our changes made in 'xx' yet to top version > > 1 object 1 > 2 object 2 (to be deleted) > > insert into my_obj (prop_1) values ('object 3 (inserted after creation of xx)'); > > switch to version 'xx'; //this functionality i'm looking for > > merge; //brings changes made in parent 'top' version > > 1 updated in version xx > 3 object 3 (inserted after creation of xx) > > post; //sends all changes upwards > > This functionality exists in GE Smallworld spatial database (see > https://www.ge.com/content/dam/gepower-new/global/en_US/downloads/gas-new-site/resources/reference/ger-4231-smallworld-4-managing-change-spatial-data.pdf) > and the use case is quite common (plan some changes in data which will > happen in real life in far future, much further away than when current > database session ends). Also the conflict management should exist (same > object being changed in multiple versions). > > Does Postgresql have anything like this? > --000000000000cfd75505efc881fd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Kirmo,

This is a pretty i= nteresting feature. I'm not sure if I've seen something like that b= efore. I recommend you to check the pg_bitemporal[1] project. It may be use= ful for you.

[1]: https://github.com/hettie-d/pg_bitemporal

Best regards.
Samed YILDIRIM


On Wed, 14 Dec 2022 = at 13:55, Kirmo Uusitalo <ki= rmo.uusitalo@gmail.com> wrote:
=20

Hi,

I'm looking for a solution for version managed (or lo= ng transaction) data in PostgreSQL (and Oracle).

This means database objects having different properties in different=20 versions of the data set. Versions could be organized in tree-like hierarch= y (each versios can have subversions). Objects can even be deleted in some = of the=20 versions of the data.

I am looking for something which would require minimal change in the app= lication logic, like

    create table my_obj(id serial primary key,prop_1 text);
   =20
    insert into my_obj (prop_1) values ('object 1');
   =20
    insert into my_obj (prop_1) values ('object 2 (to be deleted)')=
;


select * from my_obj;

1   object 1
2   object 2 (to be deleted)
create version 'xx'; //this functionality i'm looking for
switch to version 'xx'; //this functionality i'm looking for
select * from my_obj; //same data as in top version as we haven&=
#39;t changed anything yet

1   object 1
2   object 2 (to be deleted)
update my_obj set prop_1=3D'updated in version xx' where id =
=3D 1;
delete from my_obj where id=3D=
2;
select * from my_obj;

1   'updated in version xx'

switch to version 'top'; /= /let's go back to top version

select * from my_obj; //same data as before as we haven'= t changed posted our changes made in 'xx' yet to top version=

1   object 1
2   object 2 (to be deleted)
insert into my_obj (prop_1) valu=
es ('object 3 (inserted after creation of xx)')=
;

switch to version 'xx'; //= this functionality i'm looking for

merge; //brings changes made in parent 'top' ve= rsion

1   updated in version xx
3   object 3 (inserted after creation of xx)

post; //sends all changes upwards

This functionality exists in GE Smallworld spatial database (see https://www.ge.com/c= ontent/dam/gepower-new/global/en_US/downloads/gas-new-site/resources/refere= nce/ger-4231-smallworld-4-managing-change-spatial-data.pdf) and the use case is quite common (plan some changes in data which will=20 happen in real life in far future, much further away than when current=20 database session ends). Also the conflict management should exist (same=20 object being changed in multiple versions).

Does Postgresql have anything like this?

--000000000000cfd75505efc881fd--