Skip to content

Operator precedence is wrong #620

Closed
Closed
@sqlalchemy-bot

Description

@sqlalchemy-bot
Collaborator

Migrated issue, originally created by Anonymous

Operator precedence list in sql.py doesn't match the precedences used in databases.

Example:

>>> print (literal(1)  == literal(2)) == None
:literal = :literal_1 IS NULL

This will generate errors on postgresql because IS has higher precedence than comparison.


Attachments: operator_precedence.patch

Activity

sqlalchemy-bot

sqlalchemy-bot commented on Jun 25, 2007

@sqlalchemy-bot
CollaboratorAuthor

Anonymous wrote:

Patch fixing issue with unittests.

sqlalchemy-bot

sqlalchemy-bot commented on Jun 25, 2007

@sqlalchemy-bot
CollaboratorAuthor

Changes by Anonymous:

  • attached file operator_precedence.patch
sqlalchemy-bot

sqlalchemy-bot commented on Jun 25, 2007

@sqlalchemy-bot
CollaboratorAuthor

Anonymous wrote:

The current patch has a problem with boolean operators used as the comparable for BETWEEN. e.g. (literal(1) == literal(2)).between(False,True) outputs '':literal = :literal_1 BETWEEN :literal_2 AND :literal_3'', correct would be (:literal = :literal_1) BETWEEN :literal_2 AND :literal_3.

sqlalchemy-bot

sqlalchemy-bot commented on Jun 25, 2007

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

patch applied in changeset:2783. the "between" issue branched off into #621.

sqlalchemy-bot

sqlalchemy-bot commented on Jun 25, 2007

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsql

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sqlalchemy-bot

        Issue actions

          Operator precedence is wrong · Issue #620 · sqlalchemy/sqlalchemy