Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

sqlc.arg (and it's shorthand @) not working for LIMIT and OFFSET #3840

Open
733amir opened this issue Feb 13, 2025 · 0 comments
Open

sqlc.arg (and it's shorthand @) not working for LIMIT and OFFSET #3840

733amir opened this issue Feb 13, 2025 · 0 comments

Comments

@733amir
Copy link

733amir commented Feb 13, 2025

Version

1.28.0

What happened?

The sqlc.arg or @ is not working for LIMIT and OFFSET.

Relevant log output

sqlc generate failed.
# package 
query.sql:23:9: syntax error at or near "limit"

Database schema

CREATE TABLE authors (
  id   BIGSERIAL PRIMARY KEY,
  name text      NOT NULL,
  bio  text
);

SQL queries

-- name: PaginatedShorthand :many
select * from authors
limit @limit offset @offset;

-- name: Paginated :many
select * from authors
limit sqlc.arg(limit) offset sqlc.arg(offset);

Configuration

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

Playground URL

https://play.sqlc.dev/p/eced169bc45bd4aabe057c4913eaaf2c405c594271ff574dfbdff6b632527970

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant