What type of bug is this?
Unexpected error
What subsystems are affected?
Query Engine
Minimal reproduce step
Description
Starting version 1.0.1 (1.0.2 shows same behavior) we noticed, that mysql interface does not expect arguments for LIMIT.
We use golang mysql module github.com/go-jet/jet/v2/mysql
And for the query
SELECT limit_param_repro.item_id AS "out_item_id",
limit_param_repro.sample_score AS "out_sample_score"
FROM limit_param_repro
LIMIT ?;
we have 1 argument:
args (1): []interface {}{1}
and we get the below error:
args (1): []interface {}{1}
run query: sql: expected 0 arguments, got 1
Steps to reproduce:
- Create and populate test table:
CREATE TABLE limit_param_repro (
ts TIMESTAMP TIME INDEX,
item_id INT,
sample_score DOUBLE
);
INSERT INTO limit_param_repro (ts, item_id, sample_score) VALUES
(NOW(), 1, 10.0),
(NOW(), 2, 20.0),
(NOW(), 3, 30.0);
- Run the below go code:
import (
"context"
"database/sql"
"fmt"
"log"
"time"
_ "github.com/go-sql-driver/mysql"
. "github.com/go-jet/jet/v2/mysql"
)
var (
endpoint = "127.0.0.1:4002"
username = ""
password = ""
database = "public"
)
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
ts := TimestampColumn("ts")
itemID := IntegerColumn("item_id")
sampleScore := FloatColumn("sample_score")
table := NewTable("", "limit_param_repro", "", ts, itemID, sampleScore)
stmt := SELECT(
itemID.AS("out_item_id"),
sampleScore.AS("out_sample_score"),
).FROM(table).
LIMIT(1)
query, args := stmt.Sql()
fmt.Printf("SQL:\n%s\n", query)
fmt.Printf("args (%d): %#v\n\n", len(args), args)
db, err := sql.Open("mysql", dsn())
if err != nil {
log.Fatalf("open database: %v", err)
}
defer db.Close()
rows, err := db.QueryContext(ctx, query, args...)
if err != nil {
log.Fatalf("run query: %v", err)
}
defer rows.Close()
for rows.Next() {
var (
gotItemID int64
gotSampleScore float64
)
if err := rows.Scan(&gotItemID, &gotSampleScore); err != nil {
log.Fatalf("scan row: %v", err)
}
fmt.Printf("row: item_id=%d sample_score=%f\n", gotItemID, gotSampleScore)
}
if err := rows.Err(); err != nil {
log.Fatalf("read rows: %v", err)
}
}
func dsn() string {
return fmt.Sprintf("%s:%s@tcp(%s)/%s?parseTime=true", username, password, endpoint, database)
}
What did you expect to see?
No errors, but table rows in stdout.
What did you see instead?
Result you get:
SQL:
SELECT limit_param_repro.item_id AS "out_item_id",
limit_param_repro.sample_score AS "out_sample_score"
FROM limit_param_repro
LIMIT ?;
args (1): []interface {}{1}
2026/05/19 18:23:40 run query: sql: expected 0 arguments, got 1
exit status 1
What operating system did you use?
MacOS 13.0 (same behavior on Linux)
What version of GreptimeDB did you use?
1.0.2, 1.0.1
Relevant log output and stack trace
What type of bug is this?
Unexpected error
What subsystems are affected?
Query Engine
Minimal reproduce step
Description
Starting version 1.0.1 (1.0.2 shows same behavior) we noticed, that mysql interface does not expect arguments for LIMIT.
We use golang mysql module github.com/go-jet/jet/v2/mysql
And for the query
we have 1 argument:
and we get the below error:
Steps to reproduce:
What did you expect to see?
No errors, but table rows in stdout.
What did you see instead?
Result you get:
What operating system did you use?
MacOS 13.0 (same behavior on Linux)
What version of GreptimeDB did you use?
1.0.2, 1.0.1
Relevant log output and stack trace