psycopg / psycopg2

PostgreSQL database adapter for the Python programming language

Home Page:https://www.psycopg.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

psycopg2.errors.SyntaxError: trailing junk after numeric literal at or near "95c"

thisames opened this issue · comments

This is a bug tracker
If you have a question, such has "how do you do X with Python/PostgreSQL/psycopg2" please write to the mailing list or open a question instead.

Please complete the following information:

  • OS: linux
  • Psycopg version: 2.9.7
  • Python version: 3.10
  • PostgreSQL version: 16
  • pip version 23.2.1

Describe the bug
Please let us know:

1: what you did

  • I tried to do a simple query with a uuid in the condition
    2: what you expected to happen
  • query executed normally
    3: what happened instead
  • apparently psycopg2 doesn't allow me to execute a query with a uuid, it seems that python itself gets lost when it comes to the builder. I tried several variations and they all give me the same thing, I tried formatting the string in different ways too, but always the same
    Screenshot from 2023-09-23 02-22-01

If possible, provide a script reproducing the issue.

Probably your session_id is a number, so postgres is trying to convert the untyped literal you passed into a number, and barfing on the letters.

This is not a psycopg problem. Please look for advice in some PostgreSQL group.