Fixed name of psycopg2 exception