Обсуждение: ifnull

Поиск
Список
Период
Сортировка

ifnull

От
Joseph Shraibman
Дата:
Could someone tell me how to use ifnull?  Whenever I try it postgres
tells me:

playpen=> insert into tabled (userkey, value) values (2, ifnull(null,
'c'));
ERROR:  No such function 'ifnull' with the specified attributes

What I need it for is when I do an insert into my table like this:
playpen=> insert into tabled select max(userkey) + 1, 'texthere';
ERROR:  ExecAppend: Fail to add null value in not null attribute userkey

... I get a problem when I'm inserting the first data into the table
because max returns null.