-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix zero/nil values for net.IP (#1118)
- Loading branch information
Showing
3 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package issues | ||
|
||
import ( | ||
"context" | ||
"net" | ||
"testing" | ||
|
||
"github.com/ClickHouse/clickhouse-go/v2" | ||
clickhouse_tests "github.com/ClickHouse/clickhouse-go/v2/tests" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test1106(t *testing.T) { | ||
var ( | ||
conn, err = clickhouse_tests.GetConnection("issues", clickhouse.Settings{ | ||
"max_execution_time": 60, | ||
"allow_experimental_object_type": true, | ||
}, nil, &clickhouse.Compression{ | ||
Method: clickhouse.CompressionLZ4, | ||
}) | ||
) | ||
ctx := context.Background() | ||
require.NoError(t, err) | ||
const ddl = "CREATE TABLE test_1106 (col1 IPv6, col2 IPv6, col3 IPv4, col4 IPv4) Engine MergeTree() ORDER BY tuple()" | ||
require.NoError(t, conn.Exec(ctx, ddl)) | ||
defer func() { | ||
conn.Exec(ctx, "DROP TABLE IF EXISTS test_1106") | ||
}() | ||
|
||
batch, err := conn.PrepareBatch(context.Background(), "INSERT INTO test_1106") | ||
require.NoError(t, err) | ||
|
||
var ip net.IP | ||
var ipPtr *net.IP | ||
|
||
require.NoError(t, batch.Append(ip, ipPtr, ip, ipPtr)) | ||
require.NoError(t, batch.Send()) | ||
} |