-
Notifications
You must be signed in to change notification settings - Fork 968
Open
Labels
Description
Version
1.30.0
What happened?
SQLc fails to resolve the signature for PostgreSQL procedures that contain OUT parameters. Even when providing placeholders (like NULL::type or sqlc.arg), the analyzer cannot match the call to the schema definition.
Raw PostgreSQL CALL works fine.
Relevant log output
docker run --rm -v $(pwd):/src -w /src sqlc/sqlc:1.30.0 generate
# package sqlc
query.sql:2:6: function create_todo(unknown, unknown) does not exist
query.sql:5:6: function create_todo(unknown, unknown) does not exist
query.sql:8:6: function create_todo(unknown, unknown) does not existDatabase schema
CREATE TABLE todos (id serial PRIMARY KEY, task text);
CREATE PROCEDURE create_todo(IN p_task text, OUT p_id int)
LANGUAGE plpgsql AS $$
BEGIN
INSERT INTO todos (task) VALUES (p_task) RETURNING id INTO p_id;
END;
$$;SQL queries
-- name: CreateTodo1 :one
CALL create_todo(sqlc.arg(task)::text, null);
-- name: CreateTodo2 :one
CALL create_todo(sqlc.arg(task)::text, NULL::int);
-- name: CreateTodo3 :one
CALL create_todo(sqlc.arg(task)::text, sqlc.arg(id)::int);Configuration
version: "2"
sql:
- engine: "postgresql"
queries: "query.sql"
schema: "schema.sql"
gen:
go:
package: "sqlc"
out: "./sqlc"
sql_package: "pgx/v5"
emit_json_tags: true
emit_db_tags: true
emit_prepared_queries: false
emit_interface: true
emit_exact_table_names: false
emit_empty_slices: true
emit_exported_queries: true
emit_result_struct_pointers: false
emit_params_struct_pointers: false
emit_methods_with_db_argument: false
emit_pointers_for_null_types: true
emit_enum_valid_method: true
emit_all_enum_values: true
json_tags_case_style: "snake"Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go