Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

upsert with arg or narg doesn't work in sqlite3 #3508

Open
yopoyka opened this issue Jul 27, 2024 · 0 comments
Open

upsert with arg or narg doesn't work in sqlite3 #3508

yopoyka opened this issue Jul 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@yopoyka
Copy link

yopoyka commented Jul 27, 2024

Version

1.25.0

What happened?

sqlc fails to generate query placeholders and leaves @arg sqlc.arg sqlc.narg in generated query when doing upsert.
Doesn't output any errors.
Possibly related to #1881

Generated code from playground

const upsertAuthor = `-- name: UpsertAuthor :one
insert into authors (
  "id",
  "name",
  "bio"
) values (
  ?1,
  ?2,
  ?3
) on conflict("id") do update set
  "name" = @name,
  "bio" = sqlc.narg('bio')
returning id, name, bio
`

Relevant log output

No response

Database schema

create table authors (
  id   text primary key,
  name text not null,
  bio  text
);

SQL queries

-- name: UpsertAuthor :one
insert into authors (
  "id",
  "name",
  "bio"
) values (
  @id,
  @name,
  sqlc.narg('bio')
) on conflict("id") do update set
  "name" = @name,
  "bio" = sqlc.narg('bio')
returning *;

Configuration

{
  "version": "2",
  "sql": [{
    "schema": "schema.sql",
    "queries": "query.sql",
    "engine": "sqlite",
    "gen": {
      "go": {
        "out": "db"
      }
    }
  }]
}

Playground URL

https://play.sqlc.dev/p/4b01c7bd73781a3aeaf17fa1c9fba826640a5907f97b2faaee51ccac9197d00e

What operating system are you using?

Linux

What database engines are you using?

SQLite

What type of code are you generating?

Go

@yopoyka yopoyka added bug Something isn't working triage New issues that hasn't been reviewed labels Jul 27, 2024
@yopoyka yopoyka changed the title upset with arg or narg doesn't work in sqlite3 upsert with arg or narg doesn't work in sqlite3 Aug 3, 2024
@kyleconroy kyleconroy removed the triage New issues that hasn't been reviewed label Aug 5, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants