cockroachdb / cockroachdb/cockroach

plpgsql: error codes for RAISE statement doesn't match postgres

Open
#114,679 0 comments 0 reactions 0 assignees View on GitHub
A-sql-plpgsql C-bug O-qa P-3 T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

There are a few minor differences between the SQLSTATE codes returned by CRDB vs postgres (set to verbose) for the following proc:
```
CREATE PROCEDURE foo() LANGUAGE PLpgSQL AS $$
BEGIN
RAISE DEBUG 'foo';
RAISE LOG 'foo';
RAISE INFO 'foo';
RAISE NOTICE 'foo';
RAISE WARNING 'foo';
END
$$;
```
CRDB:
```
root@localhost:26257/defaultdb> CALL foo();
INFO: foo
SQLSTATE: 00000
NOTICE: foo
WARNING: foo
SQLSTATE: 00000
CALL
```
postgres:
```
postgres=# CALL foo();
INFO: 00000: foo
LOCATION: exec_stmt_raise, pl_exec.c:3883
NOTICE: 00000: foo
LOCATION: exec_stmt_raise, pl_exec.c:3883
WARNING: 01000: foo
LOCATION: exec_stmt_raise, pl_exec.c:3883
CALL
```
Postgres prints the "success" code for NOTICE, while CRDB doesn't. Also, postgres uses the 01000 "warning" code for the WARNING log level, while CRDB still uses the 00000 "success" code.

Jira issue: CRDB-33623

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.