Kareem Sedki <isiscreation@xxxxxxxxx> writes: > I am trying to write a function that takes one source and one target > data type identifiers, each as a '/text/' variable, as arguments and > return true if the cast can be made, false otherwise. I think this is fundamentally the wrong approach, because it ignores the question of whether a specific value can be cast. For example, there is a cast from int4 to int2, but that doesn't mean that 999999::int2 will succeed. What I think you should do is just try the cast and catch any error that occurs. If you really want to try to do what you're saying, look into parser/parse_coerce.c. In particular, can_coerce_type() is the authoritative answer. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general