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
Allow to cast IPv6 to IPv4 for address in proper mapping block #49759
Conversation
This is an automated comment for commit 09806bc with description of existing statuses. It's updated for the latest CI running
|
@@ -20,6 +20,13 @@ SELECT toIPv4OrNull('127.0.0.1'); | |||
|
|||
SELECT '--'; | |||
|
|||
SELECT toIPv4(toIPv6('::ffff:1.2.3.4')); | |||
SELECT toIPv4(toIPv6('::afff:1.2.3.4')); --{serverError CANNOT_CONVERT_TYPE} | |||
SELECT toIPv4OrDefault(toIPv6('::ffff:1.2.3.4')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ test also with toIPv4OrNull
? (just for completeness)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for historical reason toIPv4OrNull
and toIPv4OrZero
are not implemented with argument other than string - they are implementations of a string parser
src/Functions/FunctionsCodingIP.h
Outdated
{ | ||
if constexpr (exception_mode == IPStringToNumExceptionMode::Throw) | ||
{ | ||
throw Exception(ErrorCodes::CANNOT_CONVERT_TYPE, "IPv6 in column {} is not in IPv4 mapping block", column->getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe include vec_src[i]
in the error message?
Closes #20469
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Allow to cast IPv6 to IPv4 address for CIDR ::ffff:0:0/96 (IPv4-mapped addresses)