According to the docs, the DEFAULT keyword lets you explicitly insert a field's default value in an INSERT statement.
From a db function, I'd like to force the use of default when an input parameter is null. This syntax looks correct but fails to compile.
Any suggestions?
INSERT INTO public.test
(
userid, object_id, user_notes, object_status, created_ts
)
VALUES
(
p_userid, p_obj_id, p_user_notes, p_obj_status,
Case When p_created_ts Is Not Null Then p_created_ts Else DEFAULT End
);
I tried replacing the Case statement as follows, but it fails also: Coalesce(p_created_ts, DEFAULT)
Thanks