Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

PostgreSQL Invalid Syntax

I have this in the where clause of my SQL query:

‘2023/10/21 14:46:32.805068000’ + interval ‘1 second’

This causes me to have an "invalid input syntax for type interval" error.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Does anyone have a suggestion?

>Solution :

You need to have a timestamp datatype to calculate .

SELECT '2023/10/21 14:46:32.805068000'::timestamp + interval '1 second'
?column?
2023-10-21 14:46:33.805068
SELECT 1

fiddle

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading