Default statement_timestamp() on COPY from .csv

I created a table that looks like this:

 

CREATE TABLE SAT.THINGS_N_STUFF
(
THINGS varchar(255),
DATE timestamptz,
STUFF varchar(255),
UPLOAD_DT_TM timestamptz DEFAULT statement_timestamp()
);

 

I want the upload_dt_tm to automatically get assigned when I run this copy statement moving data from a local .csv:

 

copy
sat.things_n_stuff
from local 'C:\Desktop\thingsstuff.csv'
WITH DELIMITER ',' ABORT ON ERROR TRAILING NULLCOLS skip 1

 

But the upload_dt_tm column is getting a null value for rows created in my Vertica DB from the copy.

 

Conversly, an insert statement does what I want it to and assigns an upload_dt_tm:

 

insert into sat.things_n_stuff(
things
,date
,stuff)
VALUES(
'thing_value'
,sysdate
,'stuff_value');

 

Do I have the wrong DEFAULT setting for the UPLOAD_DT_TM column on my table?

 

Comments

  • Try setting that column to not null and get rid of the trailing nullcols.

     

    FYI, I guessed the contents of your csv since you didn't post a sample. 

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file