sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Automatically infer the types and use better Column names like offset and limit

Open eprokhor opened this issue 1 year ago • 2 comments

What do you want to change?

https://docs.sqlc.dev/en/stable/howto/named_parameters.html

Not working for postgresql. original:

...
when 'all' = $1::varchar then true
...

OFFSET $2::int LIMIT $3::int;

tried both ways in docs :

sqlc.arg(exchange) and @exchange

but get errors: queries/queries.sql:1:1: could not determine data type of parameter $1

WHY bother? Because its annoying/unclear to have to use the following in the code.

    Column1 string
    Column2 int32
    Column3 int32

What database engines need to be changed?

PostgreSQL

What programming language backends need to be changed?

Go

eprokhor avatar Mar 18 '24 15:03 eprokhor

@Jille

eprokhor avatar Mar 18 '24 15:03 eprokhor

In this old thread Kyle mentioned this would be broken indeed: https://github.com/sqlc-dev/sqlc/pull/209

Jille avatar Mar 18 '24 20:03 Jille