16.20 - REPLACE FUNCTION and Algorithmic Compression - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Detailed Topics

Teradata Database
Teradata Vantage NewSQL Engine
Release Number
March 2019
Content Type
Programming Reference
Publication ID
English (United States)

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.

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 for algorithmic compression and scsu_decomp for algorithmic decompression.

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