Default a Column’s Value: Quick Tip

Posted October 29, 2018 by Phil Molea, Sr. Information Developer, Vertica

Jim Knicely authored this tip

You can specify a table column’s default value using a DEFAULT expression. If the operation omits a value for the column, Vertica evaluates the DEFAULT expression and sets the column on load operations.

Example: dbadmin=> CREATE TABLE a (b INT, c TIMESTAMP DEFAULT sysdate); CREATE TABLE dbadmin=> INSERT INTO a (b) SELECT 1; OUTPUT -------- 1 (1 row) dbadmin=> SELECT * FROM a; b | c ---+---------------------------- 1 | 2018-10-29 03:42:33.793011 (1 row) Helpful Links:

Have fun!