cockroachdb / cockroachdb/cockroach

Add support to plpgsql for postgres' GET DIAGNOSTICS

Open
#117,410 0 comments 0 reactions 0 assignees View on GitHub
A-sql-plpgsql A-sql-routine C-enhancement T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Is your feature request related to a problem? Please describe.**
In procs/udfs, I tried to use `GET DIAGNOSTICS rc = row_count;`

**Describe the solution you'd like**
I'd like to support Postgres' implementation of this feature.

```
jim@azure.auracoda.com:26257/jim> create function fn_t1_insert (name varchar) returns int as
-> $$
-> declare
-> rc INT := 0;
-> begin
-> insert into t1 ( name ) values ( name );
->
-> GET DIAGNOSTICS rc = ROW_COUNT;
-> return rc;
-> end
-> $$ language PLpgSQL;
->
ERROR: unimplemented: attempted to use a PL/pgSQL statement that is not yet supported
SQLSTATE: 0A000
HINT: You have attempted to use a feature that is not yet implemented.

Please check the public issue tracker to check whether this problem is
already tracked. If you cannot find it there, please report the error
with details by creating a new issue.

If you would rather not post publicly, please contact us directly
using the support form.

We appreciate your feedback.
```

**Additional context**
I'm using 23.2 RC1

Jira issue: CRDB-35161

Epic CRDB-66132

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.