× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



We have a situation here where we have a parent-child table relationship with cascading deletes enabled. The system will not allow us to apply a temporal table over the child.
Here are the specifics from a system session. Any help is appreciated. Is this a bug in the DB?

/* detail table definition */

CREATE TABLE SF_CONST_DETAIL FOR SYSTEM NAME SFCONSTDP
(LINE_ID FOR COLUMN LINEID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (
START WITH 1 INCREMENT BY 1
NO MINVALUE NO MAXVALUE
NO CYCLE NO ORDER
CACHE 20 ),
BUILDING_ID FOR COLUMN LIBLDID INTEGER NOT NULL,
NAME FOR COLUMN LINAME CHAR(35) NOT NULL DEFAULT ' ',
DESCRIPTION FOR COLUMN LIDESC VARCHAR(50) NOT NULL DEFAULT ' ',
STATUS FOR COLUMN LISTS CHAR(1) NOT NULL DEFAULT 'A',

AUDIT_START FOR COLUMN ACCSTRDAT TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW BEGIN,
AUDIT_END FOR COLUMN ACCENDDAT TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW END,
AUDIT_TIME FOR COLUMN ACCAUDID TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS TRANSACTION START ID,
PERIOD SYSTEM_TIME (AUDIT_START, AUDIT_END),
AUDIT_TYPE FOR COLUMN ACCAUDTYP CHAR (1) NOT NULL GENERATED ALWAYS AS (DATA CHANGE OPERATION),
AUDIT_USER FOR COLUMN ACCAUDUSER VARCHAR(128) NOT NULL GENERATED ALWAYS AS (SESSION_USER),

CONSTRAINT LINE_MASTER_PK PRIMARY KEY( LINE_ID ),
CONSTRAINT LINE_MASTER_FK FOREIGN KEY (BUILDING_ID)
REFERENCES SF_CONST_MASTER(BUILDING_ID) ON DELETE CASCADE,
CONSTRAINT LINE_MASTER_UK UNIQUE (BUILDING_ID,NAME)
) RCDFMT SFCONSTDR;


/* creation of the history table */
CREATE TABLE SF_CONST_DETAIL_HST LIKE
SF_CONST_DETAIL;


/* add the versioning relationship between the table and the history table */
ALTER TABLE sf_const_detail ADD VERSIONING USE HISTORY TABLE sf_const_detail_HST
ON DELETE ADD EXTRA ROW;

SQL Error [428HZ]: [SQ20525] Operation on table SF_CONST_DETAIL in DCASTILLOE not allowed. Cause . . . . . : Table SF_CONST_DETAIL in DCASTILLOE cannot be used for the specified operation. The reason code is 22. 1 -- Cannot add a period to a history table. 2 -- Cannot drop a period from a system-period temporal table. 4 -- Cannot drop versioning for a table that is not a system-period temporal table. 9 -- Cannot truncate a system-period temporal table. 11 -- Cannot define a referential constraint where either the parent or child table is a history table. A primary or unique constraint cannot be defined for a history table. 12 -- Cannot detach a partition from a system-period temporal table. 13 -- Cannot add a column to a history table. 16 -- Cannot add a generated column, ROWID column, or DataLink with FILE LINK CONTROL column to a system-period temporal table. 17 -- Cannot specify ACTIVATE NOT LOGGED INITIALLY. 21 -- CREATE TABLE with the OR REPLACE option cannot reference a system-period temporal table or a history table. Recovery . . . : Drop versioning from the system-period temporal table before performing the alter to the history table or the system-period temporal table.
java.sql.SQLException: [SQ20525] Operation on table SF_CONST_DETAIL in DCASTILLOE not allowed. Cause . . . . . : Table SF_CONST_DETAIL in DCASTILLOE cannot be used for the specified operation. The reason code is 22. 1 -- Cannot add a period to a history table. 2 -- Cannot drop a period from a system-period temporal table. 4 -- Cannot drop versioning for a table that is not a system-period temporal table. 9 -- Cannot truncate a system-period temporal table. 11 -- Cannot define a referential constraint where either the parent or child table is a history table. A primary or unique constraint cannot be defined for a history table. 12 -- Cannot detach a partition from a system-period temporal table. 13 -- Cannot add a column to a history table. 16 -- Cannot add a generated column, ROWID column, or DataLink with FILE LINK CONTROL column to a system-period temporal table. 17 -- Cannot specify ACTIVATE NOT LOGGED INITIALLY. 21 -- CREATE TABLE with the OR REPLACE option cannot reference a system-period temporal table or a history table. Recovery . . . : Drop versioning from the system-period temporal table before performing the alter to the history table or the system-period temporal table.


Tim Wright

Technical Application Manager

[BBG Logo]

865-582-2214<tel:865-582-2214> (Desk) 865-299-3459<tel:865-299-3459> (Mobile)



**************************
This email message may contain confidential or privileged information. If you are not the intended recipient, please delete the message and any attachments and notify the sender by return email. You should not retain, distribute, disclose or use any of the information in this message.
**************************

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.