15.00 - REPLACE FUNCTION and Algorithmic Compression - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

Teradata Database
Programming Reference

REPLACE FUNCTION and Algorithmic Compression

You can only submit a REPLACE FUNCTION request if the compression‑related function is not used by any column across all databases and users for compressing and decompressing its data. This restriction is necessary because column data is already compressed using a certain algorithm and cannot be decompressed if the algorithm is changed.

The only exception to this rule is that a REPLACE FUNCTION request involving algorithmic compression is valid if it does not change the existing function specification in the data dictionary and its execution mode is PROTECTED. This is analogous to the way Teradata Database handles UDTs.

For example, consider the following DDL requests where the objects are created in the order indicated.

     CREATE FUNCTION scsu_comp …;
     CREATE FUNCTION scsu_decomp …;
     CREATE TABLE t1 (
       col_1 INTEGER,
       col_2 CHARACTER(10) COMPRESS ('abc', 'efg')
                           COMPRESS USING scsu_comp
                           DECOMPRESS USING scsu_decomp);

Column col_2 in table t1 references the UDFs scsu_comp and scsu_decomp for algorithmic compression and decompression respectively.

After table t1 has been created, a REPLACE FUNCTION request on either scsu_comp scsu_decomp aborts and returns an error to the requestor. This assumes that the exception conditions noted earlier are not satisfied.