sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

wrong type for params in tuple

Open ehsangifani opened this issue 1 year ago • 2 comments

Version

1.26.0

What happened?

The type for id is detected wrong.

type ListTasksParams struct {
	CreateTime   pgtype.Timestamptz
	CreateTime_2 pgtype.Timestamptz
	Limit        int32
	Offset       int32
}

func (q *Queries) ListTasks(ctx context.Context, arg ListTasksParams) ([]Task, error)

I expected it to be:

type ListTasksParams struct {
	CreateTime   pgtype.Timestamptz
	IDorSth int64
	Limit        int32
	Offset       int32
}

Relevant log output

No response

Database schema

create table tasks (
	id bigint generated by default as identity primary key,
	info text,
	create_time timestamp with time zone not null default current_timestamp
);

SQL queries

select * from tasks
where
	(create_time, id) > ($1, $2)
order by create_time, id
limit $3 offset $4;

Configuration

version: "2"
sql:
  - engine: "postgresql"
    queries: "query.sql"
    schema: "schema.sql"
    gen:
      go:
        package: "dbgw"
        out: "dbgw"
        sql_package: "pgx/v5"

Playground URL

No response

What operating system are you using?

Windows

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

ehsangifani avatar May 11 '24 15:05 ehsangifani

I have the same issue using Mac OS. @ehsangifani did you find any workaround ?

hamza-abed avatar Jul 02 '24 12:07 hamza-abed

I couldn't find any workaround. So, I wrote the code for that specific query (in another file under the same package) manually.

ehsangifani avatar Jul 04 '24 20:07 ehsangifani