- Notifications
You must be signed in to change notification settings - Fork 978
Closed
Labels
Description
Version
1.18.0
What happened?
Functions created for Postgres are not generating fields for returned row structs. For example:
type TestFuncSelectBlogRow struct{} I suspect that I'm doing something wrong, but I can't seem to figure this out. Any help would be greatly appreciated. Thank you in advance.
Relevant log output
const testFuncGetTime = `-- name: TestFuncGetTime :oneselectfrom test_fuct_get_time($1)`type TestFuncGetTimeParams struct{ TestFuctGetTime interface{} `json:"testFuctGetTime"`}type TestFuncGetTimeRow struct{}func (q *Queries) TestFuncGetTime(ctx context.Context, arg TestFuncGetTimeParams) (TestFuncGetTimeRow, error){ row := q.db.QueryRow(ctx, testFuncGetTime, arg.TestFuctGetTime) var i TestFuncGetTimeRow err := row.Scan()return i, err}const testFuncSelectBlog = `-- name: TestFuncSelectBlog :oneselectfrom test_func_select_blog($1)`type TestFuncSelectBlogParams struct{ TestFuncSelectBlog interface{} `json:"testFuncSelectBlog"`}type TestFuncSelectBlogRow struct{}func (q *Queries) TestFuncSelectBlog(ctx context.Context, arg TestFuncSelectBlogParams) (TestFuncSelectBlogRow, error){ row := q.db.QueryRow(ctx, testFuncSelectBlog, arg.TestFuncSelectBlog) var i TestFuncSelectBlogRow err := row.Scan()return i, err}const testFuncSelectString = `-- name: TestFuncSelectString :oneselectfrom test_func_select_string($1)`type TestFuncSelectStringParams struct{ TestFuncSelectString interface{} `json:"testFuncSelectString"`}type TestFuncSelectStringRow struct{}func (q *Queries) TestFuncSelectString(ctx context.Context, arg TestFuncSelectStringParams) (TestFuncSelectStringRow, error){ row := q.db.QueryRow(ctx, testFuncSelectString, arg.TestFuncSelectString) var i TestFuncSelectStringRow err := row.Scan()return i, err}Database schema
createfunctiontest_func_get_time () returns timestampAS $$ Begin return now(); End; $$ language plpgsql; createfunctiontest_select_string (in p_string text) returns textAS $$ Begin return p_string; End; $$ language plpgsql; createfunctiontest_select_blog(in p_id int) returns table (id int, name text, created_at timestamp, updated_at timestamp) AS $$ BEGIN RETURN QUERY select id, name, created_at, updated_at from blog where id = p_id; END; $$ language plpgsql;SQL queries
-- name: TestFuncGetTime :oneselect*from test_fuct_get_time($1); -- name: TestFuncSelectString :oneselect*from test_func_select_string($1); -- name: TestFuncSelectBlog :oneselect*from test_func_select_blog($1);Configuration
No response
Playground URL
https://play.sqlc.dev/p/f91c263ba2690afce4165f4febce483987995c3ba53e96a8f40bcd7e0af5fbc8
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go