Skip to content

toIPv6(x) doesn't work the same way as CAST(x AS IPv6) #5799

@alexey-milovidov

Description

@alexey-milovidov
:) select toIPv6(IPv6StringToNum('::1bc0')) format JSON

SELECT toIPv6(IPv6StringToNum('::1bc0'))
FORMAT JSON

Received exception from server (version 19.11.0):
Code: 43. DB::Exception: Received from localhost:9000, ::1. DB::Exception: Illegal type FixedString(16) of argument of function toIPv6. 

0 rows in set. Elapsed: 0.088 sec. 

:) select toIPv6('::1bc0') format JSON                 

SELECT toIPv6('::1bc0')
FORMAT JSON

{
        "meta":
        [
                {
                        "name": "toIPv6('::1bc0')",
                        "type": "IPv6"
                }
        ],

        "data":
        [
                {
                        "toIPv6('::1bc0')": "::1bc0"
                }
        ],

        "rows": 1,

        "statistics":
        {
                "elapsed": 0.000128767,
                "rows_read": 1,
                "bytes_read": 1
        }
}

1 rows in set. Elapsed: 0.001 sec. 

:) select CAST(IPv6StringToNum('::1bc0') AS IPv6) format JSON

SELECT CAST(IPv6StringToNum('::1bc0'), 'IPv6')
FORMAT JSON

{
        "meta":
        [
                {
                        "name": "CAST(IPv6StringToNum('::1bc0'), 'IPv6')",
                        "type": "IPv6"
                }
        ],

        "data":
        [
                {
                        "CAST(IPv6StringToNum('::1bc0'), 'IPv6')": "::1bc0"
                }
        ],

        "rows": 1,

        "statistics":
        {
                "elapsed": 0.000189836,
                "rows_read": 1,
                "bytes_read": 1
        }
}

1 rows in set. Elapsed: 0.001 sec.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions