Skip to content

django.db.utils.ProgrammingError: operator does not exist: character varying = bigint #740

@CASSPER24

Description

@CASSPER24

venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.errors.UndefinedFunction: operator does not exist: character varying = bigint
LINE 1: ...type_id" = 17 AND "auditlog_logentry"."object_pk" IN (SELECT...
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.

In django-auditlog, the object_pk field in LogEntry is a string field (CharField) — because the primary key of any model might be a UUID, integer, or string.

But models that use an Integer or BigInt PK, so when you use it, it causes a type mismatch: the library compares CharField = BigInt, which Postgres doesn’t allow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions