Looked into this a bit more. The problem does not exist in the trunk
(version 5.x), because it does not use these filters in get_attributes()
and pkey() any more.
The way I would fix this in version 4.x is as follows:
* In get_attnames(): Do not use get_relations() any more to check if
table exists, but check this implicitly with the following select. This
will also be faster.
* In pkey(): Remove the filter for pg_ and information_schema.
Additionally, as a feature in 4.x+5.x, but not needed for the fix:
* In get_relations(): Add a keyword parameter system=False. The method
will return system tables (i.e. pg_* and information_schema) only if
system=True. This would also be backwards compatible.
Please let me know if you think this solution is ok. I will then add
tests and patches to the 4.x and trunk.
Also @D'Arcy - can you hold off the 5.0 release for the moment until
this is fixed? It's not a problem in 5.0, but I still want to add tests
and add that parameter to get_relations() before 5.0 gets released.
-- Christoph
Am 16.03.2016 um 22:59 schrieb Patrick TJ McPhee:
Hi.
I haven't had time to work up a unit test, and I haven't checked against
trunk, yet, but it's no longer possible to db.insert() into a temp table
in 4.2.1, and presumably beyond.
e.g., this fails:
db.query("create temp table x (y int)")
db.insert('x', {'y' : 23 })
with this stack trace:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pg.py", line 949, in insert
attnames = self.get_attnames(qcl)
File "pg.py", line 805, in get_attnames
raise _prg_error('Class %s does not exist' % qcl)
pg.ProgrammingError: Class pg_temp_2.x does not exist
I've attached a patch against 4.2.1 that addresses the issue. Basically,
it accepts namespaces that start with "pg_te" in get_relations() and
pkey().
--
Herzliche Grüße
Christoph
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql