Skip to content

Support for 'update .. returning ..' syntax #797

Closed
@sqlalchemy-bot

Description

@sqlalchemy-bot
Collaborator

Migrated issue, originally created by Anonymous

(original reporter: ants) PostgreSQL supports returning the changed rows from an update statement. The syntax is ''regular_update_clause + ' RETURNING ' + column_list'', where column_list has the exact same syntax as the one in a select clause.

To support this it would be necessary to:

  1. Support adding a column list to an update clause by either adding it to a regular Update class or subclassing it for Postgres.
  2. Make the compiler support it.
  3. Make the ExecutionContext properly recognize it as a select. Changing the regexp to r'\s*(?:SELECT|FETCH|UPDATE.*RETURNING)' would work most of the time, but it should check that the RETURNING keyword isn't quoted.

Activity

sqlalchemy-bot

sqlalchemy-bot commented on Oct 2, 2007

@sqlalchemy-bot
CollaboratorAuthor

Anonymous wrote:

(original author: ants) Added together with insert support in e82ca71. Uses the postgres_returning kwarg.

sqlalchemy-bot

sqlalchemy-bot commented on Oct 2, 2007

@sqlalchemy-bot
CollaboratorAuthor

Changes by Anonymous:

  • 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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sqlalchemy-bot

        Issue actions

          Support for 'update .. returning ..' syntax · Issue #797 · sqlalchemy/sqlalchemy