Projet

Général

Profil

0001-sql-don-t-use-IF-NOT-EXISTS-when-creating-materializ.patch

Frédéric Péters, 04 mars 2016 15:48

Télécharger (1,01 ko)

Voir les différences:

Subject: [PATCH] sql: don't use 'IF NOT EXISTS' when creating materialized
 view (#9553)

(it requires postgresql 9.5)
 wcs/sql.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
wcs/sql.py
1632 1632
def create_materialized_view_if_not_exists(conn, cur):
1633 1633
    if get_publisher().pg_version < 94000:
1634 1634
        return
1635
    cur.execute('''CREATE MATERIALIZED VIEW IF NOT EXISTS wcs_materialized_all_forms
1635
    try:
1636
        cur.execute('''CREATE MATERIALIZED VIEW wcs_materialized_all_forms
1636 1637
                       AS SELECT * from wcs_all_forms''')
1638
        conn.commit()
1639
    except psycopg2.ProgrammingError:
1640
        conn.rollback()
1637 1641

  
1638 1642
@guard_postgres
1639 1643
def refresh_materialized_views():
1640
-