Tom Lane writes: > I expect what you are after is the ability to produce an 0-or-1 > numeric value from a bool field, so that you could do things like > sum(boolfield::int) to count the number of true values in a column. > I agree that we need such an operator (and I'm surprised no one's > gotten round to contributing one). Let's contribute one now ... select count(*) from test4 where a = true; select sum( case when a then 1 else 0 end ) from test4; > But I don't agree that there > should be an implicit, automatic conversion from bool to int; that > defeats half of the error-checking value of having a separate type for > truth values in the first place. Definitely. -- Peter Eisentraut Sernanders väg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера