SSC-EWI-TS0055

Default constraint was commented out and may have been added to a table definition.

This EWI is deprecated, please refer to SSC-FDM-TS0020 documentation.

Severity

Medium

Description

This EWI is added when the default constraint is present in an Alter Table statement.

Currently, there is no support for that constraint. A workaround available to transform it, is when the table is previously defined to the Alter Table, in this way we identify the references, and the default constraint is unified on the table definition; otherwise, the constraint is only commented out.

Code Example

Input Code:

CREATE TABLE table1(
  col1 integer,
  col2 varchar collate Latin1_General_CS,
  col3 date
);

ALTER TABLE table1
ADD col4 integer,
  CONSTRAINT col1_constraint DEFAULT 50 FOR col1,
  CONSTRAINT col1_constraint DEFAULT 30 FOR col1;

Output Code:

CREATE OR REPLACE TABLE table1 (
  col1 INTEGER DEFAULT 50,
  col2 VARCHAR COLLATE 'EN-CS',
  col3 DATE
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"transact"}}'
;

ALTER TABLE table1
ADD col4 INTEGER,
  CONSTRAINT col1_constraint
                             !!!RESOLVE EWI!!! /*** SSC-EWI-TS0055 - DEFAULT CONSTRAINT MAY HAVE BEEN ADDED TO TABLE DEFINITION ***/!!!
                             DEFAULT 50 FOR col1,
  CONSTRAINT col1_constraint
                             !!!RESOLVE EWI!!! /*** SSC-EWI-TS0055 - DEFAULT CONSTRAINT MAY HAVE BEEN ADDED TO TABLE DEFINITION ***/!!!
                             DEFAULT 30 FOR col1;

If all the content of the Alter Table is invalid, the Alter Table will be commented out.

Known Issues

When different default constraints are declared over the same column, only the first will be reflected on the Create Table Statement.

Recommendations

Last updated