Dear all,
I am trying to insert timestamp with timezone field (current simulation time) into a PostgreSQL column (exists with similar datatype). I can make the connection to the database, and run the models "Create BuildingTablePostGIS" and "Agents to Database in PostGIS" successfully. I am also able to insert into a PostgreSQL table records of several datatypes, but timestamp.
I tried to use date("now"), starting_date, current_date - in several formats using the string formatters- 'yyyy-MM-dd hh:mm:ss' etc. however I get an error during the insertion attempt. The error is as under:
2 occurrences in 2 agents at cycle 0: SQLSkill.insert: SQLConnection.insertBD SQLConnection.insertBD org.postgresql.util.PSQLException: ERROR: syntax error at or near "01"
Position: 111
in
in
in do insert (params:POSTGRES, columns:['origin','destination','cd_combo','cd_chademo','update_ts'], values:[98001,98002,45.67,78.85,date('now')], into:'od_cd');
in init {
write 'This model will work only if the corresponding database is installed and the database management server launched.' color: #red ;
date starting_date <- date('2019-07-01 00:00:00+07:00');
write 'Current Time ' + (self.timeStamp()) ;
write 'Connection to POSTGRESQL is ' + (self.testConnection(params:POSTGRES)) ;
write date('now') ;
do insert (params:POSTGRES, columns:['origin','destination','cd_combo','cd_chademo','update_ts'], values:[98001,98002,45.67,78.85,date('now')], into:'od_cd');
}
in agents Simulation 0, default_expr0
I tried several datatypes in my PostgreSQL column like timestamp without a timezone, time without timezone - still, the insertion does not succeed. How should the timestamp data be specified in GAMA to insert it into a timestamp (with timezone) field?