PostgreSQL Hint: You will need to rewrite or cast the expression. column "state" is of type status but expression is of type character varying
You are using Prepared Statements - PostgreSQL get info from client side, so parameter is varchar
because you are using setString
method. You should to inform Postgres, so input datatype is different with explicit cast.
PreparedStatement stmt = conn.prepareStatement(
"INSERT INTO Event (EventNum, EventName, startHour, endHour, startMin, endMin, startDate, endDate, State, depName)
VALUES (?, ?, ?, ?, ?, ?, ?::date, ?::date, ?::status, ?)");
All data are passed in text form (it is default) - so there are not a problem with passed values. PostgreSQL uses strict type system - and without explicit casting don't allow cast from varchar
to date
, enum
, int
, ...