Re: Implicit typecast behavior

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: Implicit typecast behavior
Дата
Msg-id 79bd73eb-5475-5e1f-8999-070db1725f63@gmx.net
обсуждение исходный текст
Ответ на Implicit typecast behavior  (Rick Vincent <rvincent@temenos.com>)
Список pgsql-sql
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



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Sonnenberg-Carstens, Stefan"
Дата:
Сообщение: AW: Implicit typecast behavior
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Implicit typecast behavior