How to check whether a data type can be cast to another
От
Kareem Sedki
Тема
How to check whether a data type can be cast to another
Дата
Msg-id
4AE16B83.1020501@gmail.com
Список
Дерево обсуждения
How to check whether a data type can be cast to another Kareem Sedki <isiscreation@gmail.com>
Re: How to check whether a data type can be cast to another Tom Lane <tgl@sss.pgh.pa.us>
Re: How to check whether a data type can be cast to another Kareem Sedki <isiscreation@gmail.com>
Re: How to check whether a data type can be cast to another Tom Lane <tgl@sss.pgh.pa.us>
Re: How to check whether a data type can be cast to another Kareem Sedki <isiscreation@gmail.com>
Re: How to check whether a data type can be cast to
another Alvaro Herrera <alvherre@commandprompt.com>
Re: How to check whether a data type can be cast to another Merlin Moncure <mmoncure@gmail.com>
Re: How to check whether a data type can be cast to another Merlin Moncure <mmoncure@gmail.com>
Hello all,
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 consulted the pg_cast and pg_type tables, however, I found no direct casts from 'int4' to 'text'. Even though, you SELECT CAST(4::int4 AS text) The possibility of indirect casts that use multiple intermediate casts is slim - to me. Is an 'int4' cast to 'text' by means of multiple intermediate casts from 'int4' to 'char' and eventually to 'text'?
I would prefer to have a function written in PG/PLSQL for now as we are prototyping the system. Could someone help me write such a function, please?
Thank you in advance.
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 consulted the pg_cast and pg_type tables, however, I found no direct casts from 'int4' to 'text'. Even though, you SELECT CAST(4::int4 AS text) The possibility of indirect casts that use multiple intermediate casts is slim - to me. Is an 'int4' cast to 'text' by means of multiple intermediate casts from 'int4' to 'char' and eventually to 'text'?
I would prefer to have a function written in PG/PLSQL for now as we are prototyping the system. Could someone help me write such a function, please?
Thank you in advance.
В списке pgsql-general по дате отправления