refint
functions for implementing referential integrity (obsolete)
refint : functions for implementing referential integrity (obsolete)
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4880 | refint | refint | 1.0 |
FUNC | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| See Also | tcn autoinc insert_username moddatetime table_log |
Packages
| PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|
| 1.0 | 1.0 | 1.0 | 1.0 | 1.0 |
This is a built-in contrib extension ship with the PostgreSQL kernel
Install
Create this extension with:
Usage
Provides trigger functions for implementing referential integrity checks (largely superseded by built-in foreign key constraints).
Trigger Functions
| Function | Description |
|---|---|
check_primary_key() |
Check referencing table – ensures referenced row exists |
check_foreign_key() |
Check referenced table – handles cascading actions on delete/update |
check_primary_key
Trigger on the referencing table (AFTER INSERT OR UPDATE). Parameters: referencing column name(s), referenced table name, referenced column name(s).
check_foreign_key
Trigger on the referenced table (AFTER DELETE OR UPDATE). Parameters: number of referencing tables, action (cascade, restrict, or setnull), primary key column(s), then referencing table and column pairs.