Type Conversion: Value Storage
10.4. Value Storage
Values to be inserted into a table are converted to the destination column's data type according to the following steps.
Value Storage Type Conversion
-
Check for an exact match with the target.
-
Otherwise, try to convert the expression to the target type. This will succeed if there is a registered cast between the two types. If the expression is an unknown-type literal, the contents of the literal string will be fed to the input conversion routine for the target type.
-
Check to see if there is a sizing cast for the target type. A sizing cast is a cast from that type to itself. If one is found in the
pg_cast
catalog, apply it to the expression before storing into the destination column. The implementation function for such a cast always takes an extra p