Rick Vincent schrieb am 23.07.2019 um 13:22:
>
> I am looking for a way to make postgresql function as Oracle and
> other databases do with implicit typecasts. For example, in the
> query below:
>
> SELECT RECID, RANK FROM MYTABLE WHERE RANK > 12
I know that you probably don't want to hear this, but:
That is really bad coding style in Oracle just as well as in Postgres as well.
It was a bug waiting to happen in Oracle already - the query will fail if there is at least one row where RANK can not
beconverted to number.
The correct solution to that problem is to not store numbers in VARCHAR columns - full stop.
Don't do it. Not in Postgres not in any other database.
Do the right thing and convert that column to an integer column.
Thomas