Use a "union-class" to implement cursor strategy selection.
Use a "union-class" to implement cursor strategy selection.

By union-class, I mean dynamically modifying the __class__ of the cursor object
to properly manage the data coming out of the cursor.

Being that a given cursor's type isn't actually known until after it's created,
this appears to be a fantastic way to solve this problem. It allows for
implementation selectivity logic to be wholly contained with the Cursor class,
leaving users of the class to just pass in the query or cursor_id.

This allowed for a substantial simplification in the code despite the curious
method.

python-postgres/fe,python-postgres/fe