petere/plpydbapi — pull request #1 by karenc (2013-10-08 12:33:24+00:00)
Title: Bug fixes

Hi,

I'm trying to use plpydbapi in my project to avoid duplicating code, but came across a few bugs:

- when I had more than one variable in cursor.execute, then it returns a TypeError (See "Fix format string constructed for query to use tuple instead of list...")
- when there are multiple columns to return, sometimes the order is not correct. I guess it's because plpy just returns a dict with no guaranteed order, so I used colnames to fix it (See "Use colnames to order the returned result correctly...")
- I used "insert into ... returning id" but I couldn't use cursor.fetchone() (See "Return values from non select statements too...")
- when variables are None in cursor.execute, plpydbapi tries to use "text" which may not be correct (See "Directly insert NULL into the query if a variable is None")

I know that some of the tests I added should probably be in dbapi-compliance, but the last commit in that repo was in 2009. I don't think it's still maintained, so I added all the tests in plpydbapi.

Thanks very much,
Karen