Skip to content
Advertisement

Difference between CREATE CAST and CREATE CONVERSION

In postgres, it seems there are two customizable ways to convert one value type into another via SQL, CREATE CONVERSION and CREATE CAST. What is the difference between these two items, for example what might be an example of where one might be used over another?

Advertisement

Answer

A cast has nothing to do with a conversion.

A cast converts data from one data type to another, while a conversion converts a string from one encoding to another (and does not change the data type at all).

What you are looking for is a cast. Forget about the conversion.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement