You are using Prepared Statements – PostgreSQL gets info from client side, so parameter is varchar
because you are using setString
method. You should inform Postgres with explicit cast, so that input datatype is different.
PreparedStatement stmt = conn.prepareStatement(
"INSERT INTO Event (EventNum, EventName, startHour, endHour, startMin, endMin, startDate, endDate, State, depName)
VALUES (?, ?, ?, ?, ?, ?, ?::date, ?::date, ?::status, ?)");
All data is passed in text form (it is default) – so that is not a problem with passed values. PostgreSQL uses strict type system – and without explicit casting doesn’t allow cast from varchar
to date
, enum
, int
, …