Skip to content

CAST to IPv6 on empty strings changed between 21.x and 22.x #35156

@Ryado

Description

@Ryado

Describe the issue
On empty strings, the behaviour of the function CAST('', 'IPv6') changed between the versions 21.x and 22.x

How to reproduce
On 21.8.14.5:

SELECT CAST('', 'IPv6');
Returns: 
	
::

On 22.2.2.1:

SELECT CAST('', 'IPv6');
Triggers error: 

Code: 441. DB::Exception: Invalid IPv6 value.: While processing CAST('', 'IPv6'). (CANNOT_PARSE_DOMAIN_VALUE_FROM_STRING) (version 22.2.2.1)

Additional context
This can prevent some users from upgrading to 22.x when the use of this function is spread across a number of table definitions and environments. The following workaround CAST(toFixedString('', 16), 'IPv6') works but the manual task of updating all the occurrences is challenging.

Metadata

Metadata

Assignees

Labels

backward compatibilitybugConfirmed user-visible misbehaviour in official release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions