I have a MySQL query that needs to be converted over to PostgreSQL. As I understand, PostgreSQL has no UTC_TIMESTAMP() or DATE_ADD() functions available. After reading the docs, I'm not entirely certain which date functions solve my needs in this context.
Here's the query:
INSERT INTO snippets (title, content, created, expires)
VALUES(?, ?, UTC_TIMESTAMP(), DATE_ADD(UTC_TIMESTAMP(), INTERVAL ? DAY))
For reference, here is my snippets model:
CREATE TABLE snippets (
id BIGSERIAL NOT NULL PRIMARY KEY,
title VARCHAR(100) NOT NULL,
content TEXT NOT NULL,
created TIMESTAMP(0) NOT NULL,
expires TIMESTAMP(0) NOT NULL
);
identitycolumns with modern Postgres versions