cockroachdb / cockroachdb/cockroach

sql: add support for referencing system columns using OLD and NEW trigger syntax

Open
#126,971 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.