Postgresql – refuse inserts/updates with timestamps without time-zone in postgresql

postgresqltimestamptimezone

I use exclusively timestamps with time-zone in PostgreSQL, but I just noticed something slightly worrying: If a client inserts/updates a record with a naïve time-stamp, PostgreSQL falls back to a default time-zone which is either given by an environment variable, localtime or a session-setting.

This might not always be correct.

Is it possible to configure PostgreSQL in a way that it will raise an error if it sees a value without time-zone?

Best Answer

Not sure if it is feasible in your case, but you could use functions for inserting data. Use a text parameter for the timestamp and throw an error if the string doesn't contain a + or -.