cockroachdb / cockroachdb/cockroach
sql: add support for referencing system columns using OLD and NEW trigger syntax
Open
A-sql-trigger
C-enhancement
T-sql-queries
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
In the initial trigger implementation, we will not allow the user to reference system columns (`tableoid` and `crdb_internal_mvcc_timestamp`) using the `OLD.*` and `NEW.*` syntax. As a concrete example, this will not be allowed:
```
create function f() returns trigger language plpgsql as $$
begin
raise notice '%', new.tableoid;
raise notice '%', old.crdb_internal_mvcc_timestamp;
return new;
end
$$;
```
Attempting to do so will result in an error like: `could not identify column "tableoid" in ...`.
Jira issue: CRDB-40755
Contributor guide
Assessment
This issue has not been assessed yet.