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

Regression - escape character was not considered when comparing column names #828

Closed
moming00 opened this issue Nov 22, 2022 · 3 comments · Fixed by #829
Closed

Regression - escape character was not considered when comparing column names #828

moming00 opened this issue Nov 22, 2022 · 3 comments · Fixed by #829
Assignees
Labels

Comments

@moming00
Copy link

moming00 commented Nov 22, 2022

Issue description

When upgrade ch-go from v2.3.0 to 2.4.0, our app is no longer working because of the following error:

"error":"clickhouse.Conn.PrepareBatch INSERT INTO default.test_ck_query (timestamp,dim00,dim01,dim02,dim03,metric00,metric01,metric02,metric03): block cannot be sorted - missing columns in requested order: [timestamp dim00 dim01 dim02 dim03 metric00 metric01 metric02 metric03]"

image

possibility because of the SortColumns code in block.go did not consider the escape chars.

@gingerwizard
Copy link
Collaborator

Reproducible

func Test828(t *testing.T) {
	var (
		conn, err = clickhouse_tests.GetConnection("issues", clickhouse.Settings{
			"max_execution_time": 60,
			"flatten_nested":     0,
		}, nil, &clickhouse.Compression{
			Method: clickhouse.CompressionLZ4,
		})
	)
	ctx := context.Background()
	require.NoError(t, err)
	env, err := clickhouse_tests.GetTestEnvironment(testSet)
	require.NoError(t, err)
	ddl := fmt.Sprintf("CREATE TABLE `%s`.`test_828` (Col1 String, Col2 UInt8) Engine MergeTree() ORDER BY tuple()", env.Database)
	defer func() {
		conn.Exec(ctx, fmt.Sprintf("DROP TABLE IF EXISTS `%s`.`test_828`", env.Database))
	}()
	conn.Exec(ctx, fmt.Sprintf("DROP TABLE IF EXISTS `%s`.`test_828`", env.Database))
	require.NoError(t, conn.Exec(ctx, ddl))
	batch, err := conn.PrepareBatch(ctx, fmt.Sprintf("INSERT INTO `%s`.`test_828` (`Col1`, `Col2`)", env.Database))
	require.NoError(t, err)
	require.NoError(t, batch.Append(
		"Clicky McClickHouse",
		uint8(1),
	))
	require.NoError(t, batch.Send())
}

Fixing and with release 2.4.1

@gingerwizard
Copy link
Collaborator

Will be closed by #829. 2.4.1 will be available once merge @moming00

@moming00
Copy link
Author

Will be closed by #829. 2.4.1 will be available once merge @moming00

thanks for the quick action =)

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

Successfully merging a pull request may close this issue.

2 participants