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 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, …

Leave a Comment

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş