CREATE ALIAS (Define alias)

Function

CREATE ALIAS defines a table alias to permit access to tables that exist in other RD nodes.

Privileges

Users with DBA privilege
These users can define table aliases for tables that exist in other RD nodes, using their own authorization identifiers or other users' authorization identifiers.
Users with schema privilege
These users can define table aliases for tables that exist in other RD nodes, using their own authorization identifiers.

Format

CREATE ALIAS [authorization-identifier.]table-alias
  FOR RD-node-name.authorization-identifier.table-identifier

Operands

authorization-identifier
Specifies the authorization identifier of the user who owns the table alias being defined. The default is the authorization identifier of the user who is executing this function.
table-alias
Specifies the desired alias for the table.
RD-node-name
Specifies the name of the RD node that contains the table for which the alias is being defined. The RD node name of the user's own RD node cannot be specified.
authorization-identifier
Specifies the authorization identifier of the user who owns the table alias being defined.
table-identifier
Specifies the name of the table for which the alias is being defined. The table can be a base table, a view table, or a foreign table.

Common rules

  1. Table aliases can be defined without a schema.
  2. Defining a table alias for a table that exists on one RD node does not affect other RD nodes.
  3. Users who do not have the privilege to define a table alias can use previously defined table aliases.
  4. The privilege to access tables of aliases is the same as the privilege to access tables in which the aliases are defined. The access privilege for a table that exists in a given RD node can be checked from other RD nodes.
  5. A table alias that is being defined must be distinct from the names of any base tables, view tables, or foreign tables, and from table aliases having the same authorization identifier on the local RD node as the table alias being defined.
  6. The execution of CREATE ALIAS does not result in an error if the RD node, the authorization identifier, or the table identifier that is defined in the command does not exist.

Notes

  1. The CREATE ALIAS statement cannot be specified from an X/Open-compliant UAP running under OLTP.
  2. Defining a table alias in a table alias will not result in an error during the execution of CREATE ALIAS. It can, however, produce an error when an attempt is made to access the table by specifying the nested alias.

Example

Define table alias ALS1 for a table with an RD node name NOD1, an authorization identifier USR1, and a table identifier TBL1:

CREATE ALIAS ALS1 FOR NOD1.USR1.TBL1