You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
It should return the table row type or record type or as a workarround a value which is not "unknown". The return type "unknown" removes type safety but also complicates working with the returned data.
Code snippets
If I have a table
CREATE TABLE (
id uuid,
name text
)
and I create a function returning a record of that table
CREATE FUNCTION read_group_record(group_id uuid)
RETURNS record
DECLARE
group_record record;
BEGIN
SELECT *
INTO group_record
FROM
groups
WHERE
groups.id = group_id;
RETURN group_record;
END
or a table row type of that table
CREATE FUNCTION read_group_table_row_type(group_id uuid)
RETURNS groups
DECLARE
group_record groups;
BEGIN
SELECT *
INTO group_record
FROM
groups
WHERE
groups.id = group_id;
RETURN group_record;
END
Versions of services: [Generated types | Output command generate types]
Additional context
Browser [e.g. edge, chrome]
PS: This is my first bug report. If you require more information, I am happy to provide them. If I should define the return types differently to use the type generation, please provide me an example and I will close the issue.
The text was updated successfully, but these errors were encountered:
Donnerstagnacht
changed the title
Types generated for functions returning records or table row types are unknown (incorrect)
Incorrec typescript types generated for functions returning records or table row types (generated as unknown)
May 1, 2024
Donnerstagnacht
changed the title
Incorrec typescript types generated for functions returning records or table row types (generated as unknown)
Incorrect typescript types generated for functions returning records or table row types (generated as unknown)
May 1, 2024
Describe the bug
If a postgres function returns a record or a table row type, the generated return type is "unknonwn" which is incorrect.
To Reproduce
Expected behavior
It should return the table row type or record type or as a workarround a value which is not "unknown". The return type "unknown" removes type safety but also complicates working with the returned data.
Code snippets
If I have a table
and I create a function returning a record of that table
or a table row type of that table
the generated types are:
But I would have expected something like
System information
Additional context
PS: This is my first bug report. If you require more information, I am happy to provide them. If I should define the return types differently to use the type generation, please provide me an example and I will close the issue.
The text was updated successfully, but these errors were encountered: