Indicating DEFAULT values in INSERT statement - Mailing list pgsql-general

From Postgres User
Subject Indicating DEFAULT values in INSERT statement
Date
Msg-id CADecbQkgkzMvw__GDYawY=NDOgzJ4bmZF8=bC2PuTH9BC9U+sg@mail.gmail.com
Whole thread Raw
Responses Re: Indicating DEFAULT values in INSERT statement
Re: Indicating DEFAULT values in INSERT statement
Re: Indicating DEFAULT values in INSERT statement
List pgsql-general
Hi,

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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problem with planner
Next
From: Ondrej Ivanič
Date:
Subject: Postgres on SSD