rollback; drop table if exists hs_hosting_asset_versions; drop view if exists hs_hosting_asset_hv; drop table if exists hs_hosting_asset_ex; drop procedure if exists tx_create_historicization; drop trigger if exists hs_hosting_asset_tx_historicize_tg on hs_hosting_asset; drop function if exists tx_historicize_tf(); drop type if exists tx_operation; -- ======================================================== -- Historization twiddle -- -------------------------------------------------------- rollback; begin transaction; call defineContext('historization testing', null, 'superuser-alex@hostsharing.net', 'hs_booking_project#D-1000000-hshdefaultproject:ADMIN'); -- prod+test -- 'hs_booking_project#D-1000300-mihdefaultproject:ADMIN'); -- prod -- 'hs_booking_project#D-1000300-mimdefaultproject:ADMIN'); -- test -- update hs_hosting_asset set caption='lug00 b' where identifier = 'lug00' and type = 'MANAGED_WEBSPACE'; -- prod update hs_hosting_asset set caption='hsh00 C ' || now()::text where identifier = 'hsh00' and type = 'MANAGED_WEBSPACE'; -- test update hs_hosting_asset set caption='hsh00 D ' || now()::text where identifier = 'hsh00' and type = 'MANAGED_WEBSPACE'; -- test commit; -- single version at point in time -- set hsadminng.tx_history_txid to (select max(txid) from tx_context where txtimestamp<='2024-08-27 12:13:13.450821'); set hsadminng.tx_history_txid to '3249'; set hsadminng.tx_history_timestamp to ''; -- all versions select tx_history_txid(), txc.txtimestamp, txc.currentUser, txc.currentTask, haex.* from hs_hosting_asset_ex haex join tx_context txc on haex.txid=txc.txid where haex.identifier in ('hsh00', 'mim00'); select uuid, version, identifier, caption from hs_hosting_asset_hv p where identifier in ('hsh00', 'mim00'); select pg_current_xact_id();