Skip to content

Bug: Filter on DateTime columns not working, causes type error with PostgreSQL #673

@SwAt1563

Description

@SwAt1563

When using PostgreSQL, applying filters on DateTime columns (e.g., created_at) via the admin API causes a server error due to a type mismatch in the generated SQL.

💥 Error

Filtering on a DateTime field with a request like:

GET /api/admin/api/company?where={
  "and": [
    { "created_at": { "gt": "2025-06-12T17:41:00+03:00" } }
  ]
}

Produces the following error:

sqlalchemy.exc.ProgrammingError: (psycopg.errors.UndefinedFunction)
operator does not exist: timestamp with time zone > character varying
LINE 3: WHERE backend_schema.companies.created_at > $1::VARCHAR
                                                              ^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.

This occurs because the filter value is interpreted as a VARCHAR, while the column is of type TIMESTAMPTZ.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions