[gdal-dev] Add timestamp field with value to table during ogr2ogr operation

Bo Victor Thomsen bo.victor.thomsen at gmail.com
Sun Oct 29 01:58:06 PDT 2017


To the list -

I'm converting shapefiles to postgres tables using ogr2ogr. As usual 
with ogr2ogr, it works very well.

Now I want to automatically add an extra column "created" with the 
current timestamp during the ogr2ogr operation.

Something like this:

ogr2ogr .....  -sql "SELECT *, CURRENT_TIMESTAMP AS created FROM 
point_data" ....

Shapefile name is "point_data.shp" and CURRENT_TIMESTAMP is a SQL92 
standard function

However, It doesn't work. Is there some way, I can add this timestamp 
value to the resulting table using a built-in function in ogr2ogr?

(The above command works, if you replace "CURRENT_TIMESTAMP" with ex. 
"OGR_TYPE". Obviously It doesn't produce a timestamp after this edit ;-)

Kind regards
Bo Victor Thomsen






More information about the gdal-dev mailing list