-
Notifications
You must be signed in to change notification settings - Fork 569
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
PrepareBatch fail when a table name such as db
.t
#1329
Comments
db
.t
db\
.\t\
db\
.\t\
db
.t
db
.t
db
.t
db
.t
db\
.\t\
db\
.\t\
db
.t
Added tests, my fix also helps with your issue |
Thank you for the quick fix! It works fine with the conn := clickhouse.OpenDB(options);
_, err := conn.Prepare(tc.input); // err != nil |
Could you verify on a latest version? Here is a code snippet that I wrote to reproduce your issue. It uses a helper function to initiate
|
I'm sorry, my previous description might have been a bit unclear. The latest library has fixed the Below is my test code: env, err := clickhouse_tests.GetTestEnvironment("issues")
require.NoError(t, err)
options := &clickhouse.Options{
Addr: []string{fmt.Sprintf("%s:%d", env.Host, env.HttpPort)},
Auth: clickhouse.Auth{
Database: env.Database,
Username: env.Username,
Password: env.Password,
},
Protocol: clickhouse.HTTP,
}
conn := clickhouse.OpenDB(options)
require.NoError(t, conn.Ping())
d := "CREATE DATABASE db ENGINE = Memory"
_, err = conn.Exec(d)
require.NoError(t, err)
ddl := "CREATE TABLE IF NOT EXISTS `db`.`t` (`test1` String) Engine = Memory"
_, err = conn.Exec(ddl)
require.NoError(t, err)
_, err = conn.Prepare("INSERT INTO `db`.`t`")
require.NoError(t, err) |
Observed
When the insert statement contains a database name or a table name wrapped in ``, the table name is not recognized correctly.
Code example
Error log
Details
Environment
clickhouse-go
version: 2.25.0database/sql
compatible driverCREATE TABLE
statements for tables involved: CREATE TABLE IF NOT EXISTS `db`.`t` (`test1` String) Engine = MemoryThe text was updated successfully, but these errors were encountered: