v9.0.1 on linux
thedb=# select
''''||bicolumn||'''',
coalesce(permitted_values,'is_null'),
case permitted_values when NULL then 'null' else ''''||permitted_values||'''' end
from bi_constraints limit 2;
?column? | coalesce | case
----------------+---------------+-----------------
'block' | is_null | <--- should be 'null' ??
'design_style' | rls,analog,fc | 'rls,analog,fc'
(2 rows)
Why didn't the case return 'null' in the statement above?
Thanks in Advance !
"Gauthier, Dave" <dave.gauthier@intel.com> writes:
> thedb=# select
> ''''||bicolumn||'''',
> coalesce(permitted_values,'is_null'),
> case permitted_values when NULL then 'null' else ''''||permitted_values||'''' end
> from bi_constraints limit 2;
That's equivalent to "case when permitted_values = NULL then ..." which
doesn't work, because = never succeeds on nulls. You need to write
something like "case when permitted_values IS NULL then ...".
regards, tom lane
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера