Issue
I am trying to insert a time value from Input1 on Appsmith into a time column on my database. However, I am getting an error message stating that the query preparation failed. The solution is to use moment to convert the DateTime field since the database only accepts the DateTime field in string format. Additionally, I need to update the default text in Input2 to reflect this solution and turn off prepared statements.
Resolution
PostgreSQL accepts ISO-8601 literals and parameter values out-of-the-box, so just wrap the value in single quotes (or bind it) and cast if you like:
INSERT INTO my_table(created_at)
VALUES ('2025-06-27 14:00:00'::timestamp); -- or use CURRENT_TIMESTAMP
Any string in the form YYYY-MM-DD HH24:MI:SS[±TZ]
is parsed automatically, and CURRENT_TIMESTAMP
(or NOW()
) inserts the server’s current time without extra work.