| От | Stephan Szabo |
|---|---|
| Тема | Re: problem with inserting a generated seq no into not |
| Дата | |
| Msg-id | 20040608075223.P51765@megazone.bigpanda.com обсуждение |
| Ответ на | problem with inserting a generated seq no into not null field (mike <mike@bristolreccc.co.uk>) |
| Список | pgsql-general |
> I have the following generic query which I am trying to use to insert > into a 3 field table > > INSERT INTO tb_files (subj, area, file_no) select '4', '8',(SELECT CASE > WHEN (4||8) NOT IN (SELECT (subj||area) FROM tb_files) THEN '1' ELSE That's not really a good way to detect the existance of a row with those values. If either subj or area is allowed to be NULL, wierdness occurs (*). Even if neither is allowed to be null, if the values can ever have more than one digit wierdness occurs. (*) - IIRC, even if no row exists with (4,8) as (subj,area), if there's a row where subj || area is NULL, you will never get true from the NOT IN clause and the second alternative will always be chosen. NULLs and IN don't play very well together.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера