Skip to content

"setof" behavior #404

@Corginyan

Description

@Corginyan

Describe the bug
I'm still a newbie postgresjs user, but it seems to me that the plugin does not take setof into account.

To Reproduce

create table test (
	item int not null
)

create function return_nothing()
  returns setof test
  language sql
    as $$
      select *
      from test
      where false;
    $$;

Result:

const result = await sql`select * from return_nothing();`
// Fixes to
const result = await sql<{ item: number | null }[]>`select * from return_nothing();`

For comparison:

const result = await sql`select * from test;`
// Fixes to
const result = await sql<{ item: number }[]>`select * from test;`

Expected behavior

const result = await sql<{ item: number }[]>`select * from return_nothing();`

Desktop:

  • OS: Windows 10
  • PostgreSQL version 15.8
  • Version 4.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions