UDFs that Issue Operating System I/O Calls | Teradata Vantage - UDFs that Issue Operating System I/O Calls - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-03-30
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
qnu1472247494689
lifecycle
latest
Product Category
Teradata Vantageā„¢

Here is a synopsis of the steps you take to develop, compile, install, and use a UDF that issues operating system I/O calls:

  1. Determine the level of access to operating system services that the UDF requires.
    UDF Access Level Description
    Operating system resources that ordinary operating system users can access UDF can run in protected run mode as separate process under tdatuser, a local operating system user that database installation process creates.
    Specific operating system resources Use CREATE AUTHORIZATION or REPLACE AUTHORIZATION to create context that identifies native operating system user and allows UDFs to perform I/O by running as separate processes under authorization of that user.
  2. Use the CREATE FUNCTION or REPLACE FUNCTION statement to identify the location of the source code, object, or package, and install the item on a development or test database.
    Teradata recommends against creating UDFs in Teradata system databases such as SYSLIB or SYSUDTLIB. See Installing the Function.
    Action in Previous Step Result
    Used CREATE AUTHORIZATION or REPLACE AUTHORIZATION CREATE FUNCTION or REPLACE FUNCTION sets default run mode for UDF to protected mode.

    UDF runs under tdatuser operating system user and can access system resources for which tdatuser has privileges.

    Did not use CREATE AUTHORIZATION or REPLACE AUTHORIZATION CREATE FUNCTION or REPLACE FUNCTION must specify EXTERNAL SECURITY clause to associate running of UDF with context created by CREATE AUTHORIZATION or REPLACE AUTHORIZATION statement.

    UDF runs under operating system user identified by specified context and can access system resources for which user has privileges.

    The function is compiled, if the source code is submitted, linked to the dynamic linked library (DLL or SO) associated with the database in which the function resides, and distributed to all database nodes in the system.

  3. Test and debug the UDF until UDF works correctly.

    You can use the Teradata C/C++ UDF Debugger, which is a version of GDB (the gnu Source-Level Debugger) that contains extensions. For more information, see C/C++ Command-line Debugging for UDFs.

  4. Install the UDF on your production database.
  5. Use GRANT to grant privileges to users who are authorized to use the UDF.