Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: UDFs with VOID returns types do not work as expected #108297

Closed
mgartner opened this issue Aug 7, 2023 · 0 comments · Fixed by #108299
Closed

sql: UDFs with VOID returns types do not work as expected #108297

mgartner opened this issue Aug 7, 2023 · 0 comments · Fixed by #108299
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Comments

@mgartner
Copy link
Collaborator

mgartner commented Aug 7, 2023

For example, in Postgres:

DROP FUNCTION IF EXISTS f;

CREATE FUNCTION f() RETURNS VOID LANGUAGE SQL AS 'SELECT 1';

SELECT f();
--   f
-- ------
--  NULL
-- (1 row)

In CRDB, the SELECT errors:

ERROR: value type int doesn't match type void of column "?column?"
SQLSTATE: 42804
HINT: you will need to rewrite or cast the expression

Jira issue: CRDB-30417

@mgartner mgartner added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Aug 7, 2023
@mgartner mgartner self-assigned this Aug 7, 2023
@github-project-automation github-project-automation bot moved this to Triage in SQL Queries Aug 7, 2023
@mgartner mgartner moved this from Triage to Active in SQL Queries Aug 7, 2023
craig bot pushed a commit that referenced this issue Aug 7, 2023
107383: go.mod: upgrade pgx v4 to 4.18.1 r=sean- a=sean-

Upgrade [v4.16.1 to v.4.18.1](jackc/pgx@v4.16.1...v4.18.1#files_bucket), bringing in [`puddle v1.3.0`](jackc/puddle@v1.2.1...v1.3.0#files_bucket) which fixes some edge cases related to context cancelation.

d15cc95a Add fix for using a context with a value in BeforeConnect
3edc1b5b Fix query sanitizer
dfce986b Fix panic when logging batch error
72fe5949 Upgrade to puddle v1.3.0
bce26b85 Fix atomic alignment on 32-bit platforms
1d748d9b Failsafe timeout for background pool connections
7ce634d6 Ensure there is a timeout for background pool connections
91c9e841 Ignore cancellation in puddle constructor
a814153a pgxpool: health check should avoid going below minConns

Release note: None

108213: sql: prevent panic when using UDF as EXECUTE argument r=mgartner a=mgartner

Fixes #99008

Release note (bug fix): A bug has been fixed that caused nodes to crash
when attempting to `EXECUTE` a prepared statement with an argument that
referenced a user-defined function. This bug was present since
user-defined functions were introduced in version 22.2.


108290: backupccl: make SHOW BACKUP timestamps timestampTZ r=dt a=dt

Release note (backwards-incompatible change): SHOW BACKUP's timestamp columns are now TIMESTAMPTZ, meaning they render in the session offset.
Epic: CRDB-24406.

108299: sql: fix UDF with VOID return type r=mgartner a=mgartner

Functions with VOID returns types should be allowed to produce any
number of columns of any type from their last statement. Prior to this
commit, a calling UDF with a VOID return type would error if the last
statement in the UDF did not produce a value of type VOID. This commit
fixes this minor bug.

Fixes #108297

Release note (bug fix): The last SQL statement in a user-defined
function with a VOID return type can now produce any number of columns
of any type. This bug was present since UDFs were introduced in version
22.2.


108329: build: use [email protected] via Bazel r=rickystewart a=sjbarag

Commit f7a8aa2 (ui: upgrade typescript from v4 to v5, 2023-08-03) recently upgraded to TypeScript 5.1.6. Keep the version used by rules_ts in-sync.

Epic: none
Release note: None

Co-authored-by: Sean Chittenden <[email protected]>
Co-authored-by: Marcus Gartner <[email protected]>
Co-authored-by: David Taylor <[email protected]>
Co-authored-by: Sean Barag <[email protected]>
@craig craig bot closed this as completed in aab7109 Aug 7, 2023
@github-project-automation github-project-automation bot moved this from Active to Done in SQL Queries Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant