[BUGS] "Error could not open relation with OID ..." when selecting from pg_views

Поиск
Список
Период
Сортировка
От Marcin Gozdalik
Тема [BUGS] "Error could not open relation with OID ..." when selecting from pg_views
Дата
Msg-id CADu1mRMg3Z85wALRcCCMTsPqAFNWpH5GppfcLjh9n+PApGrYsw@mail.gmail.com
обсуждение исходный текст
Список pgsql-bugs
Querying pg_views sometimes returns "Error could not open relation with OID ...".

Example program to exhibit the problem:

import sys
from threading import Thread

import psycopg2


class TempViewsCreator(Thread):
    def run(self):
        self.conn = psycopg2.connect("dbname=starfish user=starfish")
        while True:
            self.create_temp_tables()

    def create_temp_tables(self):
        cur = self.conn.cursor()
        cur.execute("CREATE OR REPLACE VIEW foo AS SELECT 1;")
# COMMENT the following commit to make the problem go away
        self.conn.commit()
        cur.execute("DROP VIEW foo;")
        self.conn.commit()
        cur.close()


def main():
    creator = TempViewsCreator()
    creator.daemon = True
    creator.start()

    while True:
        cur = None
        conn = None
        try:
            conn = psycopg2.connect("dbname=starfish user=starfish")
            cur = conn.cursor()
            cur.execute("SELECT definition FROM pg_views;")
            print('success')
        except psycopg2.Error as e:
            print('Error {e}'.format(e=e))
        finally:
            if cur:
                cur.close()
            if conn:
                conn.close()

if __name__ == '__main__':
    sys.exit(main())


I'd expect selecting from pg_views not to raise this error.

PostgreSQL 9.6.5 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609, 64-bit running on Ubuntu Xenial.
--

Marcin Gozdalik

В списке pgsql-bugs по дате отправления:

Предыдущее
От: phb07@apra.asso.fr
Дата:
Сообщение: [BUGS] BUG #14799: SELECT * FROM transition_table in a statement-leveltrigger
Следующее
От: kostin.artem@gmail.com
Дата:
Сообщение: [BUGS] BUG #14800: substring produces different results with similar types