Search Postgresql Archives

Indicating DEFAULT values in INSERT statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux