Skip to content

Not possible to have timezone in postgres #464

@max-sixty

Description

@max-sixty

(as ever, thanks for this excellent library!)

It seems that in postgres, specifying a timezone in a string is not enough for it to parse a timezone — postgres requires WITH TIMEZONE:

PostgreSQL never examines the content of a literal string before determining its type, and therefore will treat both of the above as timestamp without time zone. To ensure that a literal is treated as timestamp with time zone, give it the correct explicit type:

TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+02'

And sqlparser seems to discard that term:

https://github.com/sqlparser-rs/sqlparser-rs/blob/8f207db0598139310211e808ea6e5f853d3a3a96/src/parser.rs

So IIUC it's not currently possible to correctly parse a postgres TIMESTAMP WITH TIME ZONE

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions