Skip to content

A way to run non-transactional DDL commands / PG requires autocommit to modify a type ?! #123

@sqlalchemy-bot

Description

@sqlalchemy-bot

Migrated issue, originally created by Wichert Akkerman (@wichert)

Unfortunately not all DDL commands for PostgreSQL can be used in a transaction. I ran into this when trying to add a new value to an enum:

db=# BEGIN;
BEGIN
db=# ALTER TYPE article_type ADD VALUE 'unknown';
ERROR:  ALTER TYPE ... ADD cannot run inside a transaction block

I'm not sure what the best way to handle this is in alembic currently. Perhaps do op.execute('COMMIT') manually? Perhaps alembic needs an in-between-commit operation for this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions