Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WEEK is a valid interval unit #408

Open
iainsproat opened this issue Jun 26, 2024 · 0 comments
Open

WEEK is a valid interval unit #408

iainsproat opened this issue Jun 26, 2024 · 0 comments

Comments

@iainsproat
Copy link

Describe the bug

WEEK should be recognised as a valid interval unit.
pg 16: https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
pg 14: https://www.postgresql.org/docs/14/datatype-datetime.html#DATATYPE-INTERVAL-INPUT

Error: 
    UPDATE object_preview
    SET
      "previewStatus" = 1,
      "lastUpdate" = NOW()
    FROM (
      SELECT "streamId", "objectId" FROM object_preview
      WHERE "previewStatus" = 0 OR ("previewStatus" = 1 AND "lastUpdate" < NOW() - INTERVAL '1 WEEK')
      ORDER BY "priority" ASC, "lastUpdate" ASC
      LIMIT 1
    ) as task
    WHERE object_preview."streamId" = task."streamId" AND object_preview."objectId" = task."objectId"
    RETURNING object_preview."streamId", object_preview."objectId"
   - invalid syntax at line 1 col 3:

1  1 week
     ^
Unexpected input (lexer error). Instead, I was expecting to see one of the following:

    - A "dot" token
    - A "colon" token
    - A "years" token
    - A "months" token
    - A "days" token
    - A "hours" token
    - A "minutes" token
    - A "seconds" token
    - A "milliseconds" token



💥 This is a nasty error, which was unexpected by pg-mem. Also known "a bug" 😁 Please file an issue !

To Reproduce

A more minimal example to reproduce:

SELECT "id" FROM my_table
      WHERE "lastUpdate" < NOW() - INTERVAL '1 WEEK'

pg-mem version

2.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant