Am 02.01.2017 um 03:15 schrieb Justin Pryzby:
After instaling the latest version, I discovered that our singular use of
namedresult() is broken, following the pygres implementation of LRU cache,
since our field names includes underscores, which are not "isalnum()".

You're right, that was a change that should have at least be documented. Will add it to the docs and changelog now. This mechanism was already used in the DB API 2 module, and in that patch, the same mechanism was then taken over in the classic module together with the LRU cache for the named tuples.

identifier separator (as it doesn't require column quoting), since
and since the "fallback" column names use underscores, and since the
behavior is somewhat overly-restrictive.

Actually underscores used as separators should work, only leading underscores are a problem, because of the namedtuple restrictions you quoted.

The somewhat overly-restrictive behavior checking for isalnum() should only be used with old Python versions (2.6 and 3.0). Do you use one of these? Then my suggestion is to document the change and make the check more specific for Py 2.6 and 3.0.

It's not clear to me if there's any reason not to let namedtuple
raise ValueError for any prohibited names, rather than renaming them
to column_n, especially since that behavior of pygresql isn't
documented. (But, that would mean that query("SELECT
*").namedtuple() would crash a program if a column was added which
was an invalid name).

That exactly was the reasoning. The idea was that programs using namedtuples that worked before the patch (since they used valid names) should continue to work (except Py 2.6/3.0 was handled too sloppy).

-- Christoph
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to