[MDEV-17686] BIGINT type doesn't work within CAST Created: 2018-11-12  Updated: 2019-03-29

Status: Stalled
Project: MariaDB Server
Component/s: Data types
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Paul Pogonyshev Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None


 Description   

I need the following for the workaround suggested in MDEV-13297:

SELECT CAST(NULL AS BIGINT)

However, this gives a syntax error. Using INT instead works, but I don't know if MariaDB will now cut unioned values for the same column:

SELECT CAST(NULL AS INT)



 Comments   
Comment by Elena Stepanova [ 2018-11-12 ]

CAST and CONVERT only support a subset of data types, BIGINT is not one of them.

Comment by Paul Pogonyshev [ 2018-11-12 ]

And what is the reason? If I have a generic application, why does it have to special-case BIGINT instead of just casting to whatever type it needs? What should I use in place of BIGINT for a query similar to that in MDEV-13297? Why doesn't MariaDB issue a better error, at least explicitly stating that this type is not supported in CAST?

Comment by Elena Stepanova [ 2018-11-12 ]

If you want to contribute a patch which changes the behavior to better, we'll be happy to consider it.

Comment by Paul Pogonyshev [ 2018-11-13 ]

So, according to MDEV-13297 I need to cast my NULL to BIGINT, but of course CAST doesn't support that. I cannot cast to INT, because that truncates the result without warning (yes, I tested). The only workaround I found is casting to DECIMAL. But it's perfect even if you need to search for non-obvious workarounds and not a bug, because it is documented. I see.

Comment by Elena Stepanova [ 2018-11-13 ]

There is still hope that MDEV-12325 will eventually get fixed, at least it remains open for time being.

For CAST limitations, however upsetting they are, even if we had the capacity to lift some of them, it would not go to 10.3 which is already in the post-GA stage; and it would be very unlikely to make it to 10.4, unless somebody contributes a patch of a good quality which could be merged into the main tree easily enough.

Comment by Chris Calender (Inactive) [ 2019-01-10 ]

Changed from Closed bug to Open Feature Request.

Generated at Thu Feb 08 08:38:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.