Creates a unique key constraint on a global or central table.
A unique constraint can be defined on one or more columns; and multiple unique constraints can be defined on a table, but each unique constraint must cover a different combination of columns.
Available in a network database and requires the star$define role.
Parameters:
| Name | Optional | Type | Description |
| table$ | Mandatory | Text | The table to create the primary key constraint on. |
| columns$ | Mandatory | Text | List of columns in the primary key constraint. |
Examples:
SELECT create_unique_constraint('mytable','cola'); -- creates a unique constraint on one column.
SELECT create_unique_constraint('mytable','cola,colb'); -- creates a unique constraint on two columns.
Tips:
- The star$constraints view indicates which constraints already exist.
- The columns parameter is a comma separated list of column names included in the constraint.
Comments
Article is closed for comments.