postgresql-tableversion icon indicating copy to clipboard operation
postgresql-tableversion copied to clipboard

cannot version unversioned table (inconsistent view on the matter)

Open strk opened this issue 5 years ago • 10 comments

See this session:

lol_3_17=# select table_version.ver_version();
1.7.0dev 1.6.0-16-g7fabb6f
lol_3_17=# select table_version.ver_is_table_versioned('bde_ext', 'adjustment_run');
f
lol_3_17=# select table_version.ver_enable_versioning('bde_ext', 'adjustment_run');
ERROR:  Table bde_ext.adjustment_run is already versioned

Basically, ver_is_table_versioned says a table is NOT versioned while ver_enable_versioning says the table is ALREADY versioned... annoying enough

strk avatar Mar 21 '19 11:03 strk

There's no trigger on the table:

lol_3_17=# \d bde_ext.adjustment_run
                Table "bde_ext.adjustment_run"
       Column       |            Type             | Modifiers 
--------------------+-----------------------------+-----------
 id                 | integer                     | not null
 adm_id             | integer                     | not null
 cos_id             | integer                     | not null
 status             | character varying(4)        | not null
 usr_id_exec        | character varying(20)       | not null
 adjust_datetime    | timestamp without time zone | 
 description        | character varying(100)      | 
 sum_sqrd_residuals | numeric(22,12)              | 
 redundancy         | numeric(22,12)              | 
 wrk_id             | integer                     | 
 audit_id           | integer                     | not null
Indexes:
    "pkey_adjustment_run" PRIMARY KEY, btree (id)

The table_version.versioned_table table is empty. The only thing is that a table_version.bde_ext_adjustment_run_revision table exists.

What should we do in these cases ? Shall we consider the table as versioned or non-versioned ?

strk avatar Mar 21 '19 11:03 strk

I think it should be considered as non-versioned. How has that happen ?

imincik avatar Mar 21 '19 20:03 imincik

I think it should be considered as non-versioned. How has that happen ?

I drop cascaded the schema containing those tables, and later re-created them via schema loader. The tables under table_version did not cascade (maybe this could be obtained, with some improvements to our DDL trigger).

strk avatar Mar 22 '19 09:03 strk

This issue has been automatically marked as stale as there has not been any activity for sometime. The issue will be closed in 14 days if no further activity.

stale[bot] avatar Apr 05 '19 09:04 stale[bot]

This task is still relevant.

imincik avatar Apr 06 '19 15:04 imincik

This issue has been automatically marked as stale as there has not been any activity for sometime. The issue will be closed in 14 days if no further activity.

stale[bot] avatar Apr 20 '19 16:04 stale[bot]

This task is still relevant.

imincik avatar Apr 23 '19 08:04 imincik

This issue has been automatically marked as stale as there has not been any activity for sometime. The issue will be closed in 14 days if no further activity.

stale[bot] avatar May 07 '19 08:05 stale[bot]

This task is still relevant.

imincik avatar May 07 '19 09:05 imincik

This seems like quite an edge case. Would require someone to drop cascade and then rebuild with schema loader.

billgeo avatar Jun 08 '22 23:06 billgeo