Re: Casting Integer to Boolean in assignment

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: Casting Integer to Boolean in assignment
Дата
Msg-id b379116f-2fc6-410c-c83d-e916bad44e50@gmx.net
обсуждение исходный текст
Ответ на Re: Casting Integer to Boolean in assignment  (Geoff Winkless <pgsqladmin@geoff.dj>)
Ответы Re: Casting Integer to Boolean in assignment  (Geoff Winkless <pgsqladmin@geoff.dj>)
Список pgsql-general
Geoff Winkless schrieb am 24.01.2019 um 12:45:
> The reason for that at least is that '1' and '0' are valid boolean values.
> 
> https://www.postgresql.org/docs/9.5/datatype-boolean.html
> 
> There's additional text describing why casts are chosen to be defined
> as implicit or not here
> 
> https://www.postgresql.org/docs/9.5/typeconv-overview.html
> 
> My own opinion is that non-0 should implicitly cast as true and 0
> should cast as false. 

I strongly disagree - that would mimic MySQL's idiosyncrasies and would make such a query valid:

  delete from orders
  where 42;



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

Предыдущее
От: Geoff Winkless
Дата:
Сообщение: Re: Casting Integer to Boolean in assignment
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: Need a command to take the backup of the child tables along withits master table.