Skip to content

Commit

Permalink
fix unhex and flavor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyuancheung committed Dec 13, 2022
1 parent b73711d commit 2aefd5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions flavor.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (f Flavor) PrepareInsertIgnore(table string, ib *InsertBuilder) {
ib.verb = "INSERT IGNORE"
case PostgreSQL:
// see https://www.postgresql.org/docs/current/sql-insert.html
ib.verb = "INSERT"
ib.verb = "INSERT INTO"
// add sql statement at the end after values, i.e. INSERT INTO ... ON CONFLICT DO NOTHING
ib.marker = insertMarkerAfterValues
ib.SQL("ON CONFLICT DO NOTHING")
Expand All @@ -153,7 +153,7 @@ func (f Flavor) PrepareInsertIgnore(table string, ib *InsertBuilder) {
ib.verb = "INSERT OR IGNORE"
case ClickHouse:
// see https://clickhouse.tech/docs/en/sql-reference/statements/insert-into/
ib.verb = "INSERT"
ib.verb = "INSERT INTO"
default:
// panic if the db flavor is not supported
panic(fmt.Errorf("unsupported db flavor: %s", ib.args.Flavor.String()))
Expand Down
2 changes: 1 addition & 1 deletion interpolate.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ func encodeValue(buf []byte, arg interface{}, flavor Flavor) ([]byte, error) {
buf = appendHex(buf, data)

case ClickHouse:
buf = append(buf, "_binary"...)
buf = append(buf, "unhex"...)
buf = quoteStringValue(buf, *(*string)(unsafe.Pointer(&data)), flavor)
}

Expand Down

0 comments on commit 2aefd5c

Please sign in to comment.