Edgewall Software

Ticket #10406: 10406-search-path-r10830.patch

File 10406-search-path-r10830.patch, 878 bytes (added by Remy Blank, 5 years ago)

Catch the right exception for PostgreSQL 9.1.

  • trac/db/postgres_backend.py

    diff --git a/trac/db/postgres_backend.py b/trac/db/postgres_backend.py
    a b has_psycopg = False 
    3131try:
    3232    import psycopg2 as psycopg
    3333    import psycopg2.extensions
    34     from psycopg2 import ProgrammingError as PGSchemaError
     34    from psycopg2 import DataError, ProgrammingError
    3535    from psycopg2.extensions import register_type, UNICODE, \
    3636                                    register_adapter, AsIs, QuotedString
    3737
    class PostgreSQLConnection(ConnectionWra 
    211211                self.schema = params['schema']
    212212                cnx.cursor().execute('SET search_path TO %s', (self.schema,))
    213213                cnx.commit()
    214         except PGSchemaError:
     214        except (DataError, ProgrammingError):
    215215            cnx.rollback()
    216216        ConnectionWrapper.__init__(self, cnx, log)
    217217