lxn/go-pgsql — Issue #10: Example for insert query with placeholders?
Author: vendion
Created: 2012-03-07 16:16:36+00:00
State: open

Is it possible if you would add, or at least explain, how go-pgsql expects querys with place holders to be done?

In my current code I am doing this:

```go
tx, err := db.Begin()
stmt, err := tx.Prepare("insert into foo (number, value) values (?,?)")
if err != nil {
fmt.Println(err)
db.Close()
os.Exit(1)
}
derfer stmt.Close()

_, err = stmt.Exec("Twelve", 12)
if err != nil {
fmt.Println(err)
db.Close()
os.Exit(1)
}
tx.Commit()
```

Doing so gives this error:

```Severity: ERROR
Code: 42601
Message: syntax error at or near ","
Detail:
Hint:
Position: 39
Internal Position:
Internal Query:
Where:
File: scan.l
Line: 1001
Routine: scanner_yyerror
exit status 1
```

I am using go version weekly.2012-03-04 +5c664f190e4e as well as the database/sql package.