Skip to content
Advertisement

Insert date now + interval 2 days

for some reason I am getting a syntax error:

From what I’ve read this should be the correct syntax.

Advertisement

Answer

The interval value needs to be enclosed in single quotes:

The specification '2 days' as a single string is a Postgres extension to the SQL standard. A SQL standard compliant way of writing this would be interval '2' day or written with a full interval specification: interval '2' day to minute

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement