try coalesce:
The COALESCE function returns the first of its arguments that is not
null. Null is returned only if all arguments are null
SELECT coalesce(max(code_id) + 1, 1)
FROM configentries
WHERE configtable_id = ...
try coalesce:
The COALESCE function returns the first of its arguments that is not
null. Null is returned only if all arguments are null
SELECT coalesce(max(code_id) + 1, 1)
FROM configentries
WHERE configtable_id = ...