-
Notifications
You must be signed in to change notification settings - Fork 885
sqlc crashes when calling a function with OUT arg #1654
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
Comments
I also reproduced this on HEAD of main, b0d6f13 |
With a little more experimentation, I found that adding Modifying the code to |
* test: add a test case for #1654 * fix(compiler): Support functions with OUT params * Add generated code --------- Co-authored-by: Andrew Benton <[email protected]>
Does not work in version 1.26.
|
Does not work in version 1.27.0 CREATE OR REPLACE FUNCTION next_id(IN seq regclass, OUT result bigint) AS $$
DECLARE
-- 6/4/2013 00:00:00 GMT
our_epoch bigint := 1370304000000;
seq_id bigint;
now_millis bigint;
shard_id int := 1;
BEGIN
SELECT nextval(seq) % 1024 INTO seq_id;
SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000) INTO now_millis;
result := (now_millis - our_epoch) << 23;
result := result | (shard_id << 10);
result := result | (seq_id);
END;
$$ LANGUAGE PLPGSQL;
|
Uh oh!
There was an error while loading. Please reload this page.
Version
1.13.0
What happened?
I tried to call a function which has an OUT argument. I am seeing sqlc crash a lot when I try to do this. I realize I might have botched the syntax or something somewhat, but the crash is making diagnosis of the problem harder.
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/a6294fc50b0b186b26f9ff70895aefec3fc9f2e19390bcf81e91021aacde0231
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: