cockroachdb / cockroachdb/cockroach
sql: support print_strict_params option in PL/pgSQL
- 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.**
On 24.1 if I run the following:
```
CREATE TABLE users (userid INT, username TEXT);
CREATE FUNCTION get_userid(username text) RETURNS int
AS $$
#print_strict_params on
DECLARE
userid int;
BEGIN
SELECT users.userid INTO STRICT userid
FROM users WHERE users.username = get_userid.username;
RETURN userid;
END;
$$ LANGUAGE plpgsql;
SELECT get_userid('blah');
```
I get the error:
```
ERROR: at or near "#": syntax error
SQLSTATE: 42601
DETAIL: source SQL:
#print_strict_params on
^
```
**Describe the solution you'd like**
This should work, since it's supported in Postgres:
```
postgres=# SELECT get_userid('blah');
ERROR: query returned no rows
DETAIL: parameters: username = 'blah'
CONTEXT: PL/pgSQL function get_userid(text) line 6 at SQL statement
```
Jira issue: CRDB-38462
Contributor guide
Assessment
This issue has not been assessed yet.