forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ClickHouse#35928 from ClickHouse/backport/22.3/35733
Backport ClickHouse#35733 to 22.3: Added settings for insert of invalid IPv6, IPv4 values
- Loading branch information
Showing
6 changed files
with
108 additions
and
4 deletions.
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
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
10 changes: 10 additions & 0 deletions
10
tests/queries/0_stateless/02244_ip_address_invalid_insert.reference
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,10 @@ | ||
1.1.1.1 1.1.1.1 | ||
0.0.0.0 | ||
1.1.1.1 1.1.1.1 | ||
0.0.0.0 | ||
fe80::9801:43ff:fe1f:7690 fe80::9801:43ff:fe1f:7690 | ||
1.1.1.1 :: | ||
:: | ||
fe80::9801:43ff:fe1f:7690 fe80::9801:43ff:fe1f:7690 | ||
1.1.1.1 ::ffff:1.1.1.1 | ||
:: |
81 changes: 81 additions & 0 deletions
81
tests/queries/0_stateless/02244_ip_address_invalid_insert.sql
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,81 @@ | ||
DROP TABLE IF EXISTS test_table_ipv4; | ||
CREATE TABLE test_table_ipv4 | ||
( | ||
ip String, | ||
ipv4 IPv4 | ||
) ENGINE = TinyLog; | ||
|
||
INSERT INTO test_table_ipv4 VALUES ('1.1.1.1', '1.1.1.1'), ('', ''); --{clientError 441} | ||
|
||
SET input_format_ipv4_default_on_conversion_error = 1; | ||
|
||
INSERT INTO test_table_ipv4 VALUES ('1.1.1.1', '1.1.1.1'), ('', ''); | ||
SELECT ip, ipv4 FROM test_table_ipv4; | ||
|
||
SET input_format_ipv4_default_on_conversion_error = 0; | ||
|
||
DROP TABLE test_table_ipv4; | ||
|
||
DROP TABLE IF EXISTS test_table_ipv4_materialized; | ||
CREATE TABLE test_table_ipv4_materialized | ||
( | ||
ip String, | ||
ipv6 IPv4 MATERIALIZED toIPv4(ip) | ||
) ENGINE = TinyLog; | ||
|
||
INSERT INTO test_table_ipv4_materialized(ip) VALUES ('1.1.1.1'), (''); --{serverError 441} | ||
|
||
SET input_format_ipv4_default_on_conversion_error = 1; | ||
|
||
INSERT INTO test_table_ipv4_materialized(ip) VALUES ('1.1.1.1'), (''); --{serverError 441} | ||
|
||
SET cast_ipv4_ipv6_default_on_conversion_error = 1; | ||
|
||
INSERT INTO test_table_ipv4_materialized(ip) VALUES ('1.1.1.1'), (''); | ||
SELECT ip, ipv6 FROM test_table_ipv4_materialized; | ||
|
||
SET input_format_ipv4_default_on_conversion_error = 0; | ||
SET cast_ipv4_ipv6_default_on_conversion_error = 0; | ||
|
||
DROP TABLE test_table_ipv4_materialized; | ||
|
||
DROP TABLE IF EXISTS test_table_ipv6; | ||
CREATE TABLE test_table_ipv6 | ||
( | ||
ip String, | ||
ipv6 IPv6 | ||
) ENGINE = TinyLog; | ||
|
||
INSERT INTO test_table_ipv6 VALUES ('fe80::9801:43ff:fe1f:7690', 'fe80::9801:43ff:fe1f:7690'), ('1.1.1.1', '1.1.1.1'), ('', ''); --{clientError 441} | ||
|
||
SET input_format_ipv6_default_on_conversion_error = 1; | ||
|
||
INSERT INTO test_table_ipv6 VALUES ('fe80::9801:43ff:fe1f:7690', 'fe80::9801:43ff:fe1f:7690'), ('1.1.1.1', '1.1.1.1'), ('', ''); | ||
SELECT ip, ipv6 FROM test_table_ipv6; | ||
|
||
SET input_format_ipv6_default_on_conversion_error = 0; | ||
|
||
DROP TABLE test_table_ipv6; | ||
|
||
DROP TABLE IF EXISTS test_table_ipv6_materialized; | ||
CREATE TABLE test_table_ipv6_materialized | ||
( | ||
ip String, | ||
ipv6 IPv6 MATERIALIZED toIPv6(ip) | ||
) ENGINE = TinyLog; | ||
|
||
INSERT INTO test_table_ipv6_materialized(ip) VALUES ('fe80::9801:43ff:fe1f:7690'), ('1.1.1.1'), (''); --{serverError 441} | ||
|
||
SET input_format_ipv6_default_on_conversion_error = 1; | ||
|
||
INSERT INTO test_table_ipv6_materialized(ip) VALUES ('fe80::9801:43ff:fe1f:7690'), ('1.1.1.1'), (''); --{serverError 441} | ||
|
||
SET cast_ipv4_ipv6_default_on_conversion_error = 1; | ||
|
||
INSERT INTO test_table_ipv6_materialized(ip) VALUES ('fe80::9801:43ff:fe1f:7690'), ('1.1.1.1'), (''); | ||
SELECT ip, ipv6 FROM test_table_ipv6_materialized; | ||
|
||
SET input_format_ipv6_default_on_conversion_error = 0; | ||
SET cast_ipv4_ipv6_default_on_conversion_error = 0; | ||
|
||
DROP TABLE test_table_ipv6_materialized; |