Creates a primary key constraint on a global or central table.
Only one primary key constraint can be defined on a table. A primary key constraint can be defined on one or more 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_primary_constraint('mytable','cola'); -- creates a primary key constraint on one column.
SELECT create_primary_constraint('mytable','cola,colb'); -- creates a primary key constraint on two columns.
Tips:
- The columns parameter is a comma separated list of column names included in the constraint.
- The star$constraints view indicates which constraints already exist.
Comments
Article is closed for comments.