Skip to content

Commit ece8f67

Browse files
committed
fix: 'code: 62, message: Empty query'
1 parent 9b480b5 commit ece8f67

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

conn_batch.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ func (b *batch) Send() (err error) {
125125
if b.err != nil {
126126
return b.err
127127
}
128+
if b.block.Rows() == 0 {
129+
return nil
130+
}
128131
if err = b.conn.sendData(b.block, ""); err != nil {
129132
return err
130133
}

tests/empty_query_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ func TestEmptyQuery(t *testing.T) {
2424
if assert.NoError(t, err) {
2525
const ddl = `
2626
CREATE TEMPORARY TABLE test_empty_query (
27-
Col1 UInt8
27+
Col1 UInt8
28+
, Col2 Array(UInt8)
29+
, Col3 LowCardinality(String)
30+
, NestedCol Nested (
31+
First UInt32
32+
, Second UInt32
33+
)
2834
)
2935
`
3036
if err := conn.Exec(ctx, ddl); assert.NoError(t, err) {

0 commit comments

Comments
 (0)