Skip to content

Syntax error in: date < date + interval #1096

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

Closed
pavel-francirek opened this issue Oct 31, 2023 · 1 comment
Closed

Syntax error in: date < date + interval #1096

pavel-francirek opened this issue Oct 31, 2023 · 1 comment

Comments

@pavel-francirek
Copy link

  • asyncpg version:
  • python3-asyncpg 0.25.0-1build1
  • PostgreSQL version:
  • 15.4 (Ubuntu 15.4-2.pgdg22.04+1)
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    :
    no
  • Python version:
  • Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
  • Platform:
  • Ubuntu 22.04
  • Do you use pgbouncer?:
  • no
  • Did you install asyncpg with pip?:
  • no
  • If you built asyncpg locally, which version of Cython did you use?:
  • Can the issue be reproduced under both asyncio and
    uvloop?
    :

Strange error that looks like adding interval to date results in interval type (not date). Example traceback:

ProgrammingError: (sqlalchemy.dialects.postgresql.asyncpg.ProgrammingError) <class 'asyncpg.exceptions.UndefinedFunctionError'>: operator does not exist: date < interval
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
[SQL: 
        SELECT
            *
        FROM result
        WHERE date_create >= %s
            AND date_create < %s + INTERVAL '1 day'
         ORDER BY date_create]
[parameters: (datetime.date(2021, 1, 1), datetime.date(2021, 1, 31))]
(Background on this error at: https://sqlalche.me/e/14/f405) while handling path /api/v1/result/
Traceback of APIApp (most recent call last):

  UndefinedFunctionError: operator does not exist: date < interval
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
    File /usr/lib/python3/dist-packages/sqlalchemy/dialects/postgresql/asyncpg.py, line 399, in _prepare_and_execute
    prepared_stmt, attributes = await adapt_connection._prepare(

    File /usr/lib/python3/dist-packages/sqlalchemy/dialects/postgresql/asyncpg.py, line 641, in _prepare
    prepared_stmt = await self._connection.prepare(operation)

    File /usr/lib/python3/dist-packages/asyncpg/connection.py, line 566, in prepare
    return await self._prepare(

    File /usr/lib/python3/dist-packages/asyncpg/connection.py, line 584, in _prepare
    stmt = await self._get_statement(

    File /usr/lib/python3/dist-packages/asyncpg/connection.py, line 398, in _get_statement
    statement = await self._protocol.prepare(

    File asyncpg/protocol/protocol.pyx, line 168, in prepare
@pavel-francirek
Copy link
Author

sorry, my fault

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