tursodatabase / libsql-client-go

Go client API for libSQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unsupported Positional Parameters

juliuslipp opened this issue · comments

Hey guys,

I'm getting the following error when trying to query something with positional parameters:

error: unsuppoted positional parameter. This driver does not accept positional parameters with indexes (like ?<number>)"

With the (libsql-cgo)[https://github.com/libsql/go-libsql] client the query works without any problems (but the client has other problems lol)

Example query:

SELECT * FROM example
WHERE example_id = coalesce(?1,  example_id) or swag_id = coalesce(?2, swag_id)

Note that normal positional parameters are supported. Only the ones with indexes are not supported. See https://github.com/tursodatabase/libsql-client-go/blob/main/examples/sql/counter/main.go#L80

Is there any plan to add support to it? I have a query that I want to repeat the parameter in a subquery.

insert into
    products (list_id, name, cycle)
values
   (?1, ?2, coalesce((select min(cycle) from products where list_id = ?1), 0))
returning id;

I opened a PR to add support for it.