problem with inserting a generated seq no into not null field - Mailing list pgsql-general

From mike
Subject problem with inserting a generated seq no into not null field
Date
Msg-id 1086694668.31284.18.camel@datacc
Whole thread Raw
Responses Re: problem with inserting a generated seq no into not null field  (Manfred Koizar <mkoi-pg@aon.at>)
Re: problem with inserting a generated seq no into not  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List 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
max(file_no)+1 END FROM tb_files GROUP BY (subj||area),subj,area HAVING
subj = '4' AND area = '8');

However the first entry will not go in with a

 'null value in column "file_no" violates not-null constraint'

message

Anyone any ideas on this - the CASE statement does not seem to be being
evaluated



pgsql-general by date:

Previous
From: jseymour@linxnet.com (Jim Seymour)
Date:
Subject: Re: encrypted passwords
Next
From:
Date:
Subject: Re: encrypted passwords