fix bug 1095584 - PostgreSQL fixes

PostgreSQL has different behavior than SQLite in tests.  The biggest is primary key assignment.  The second SQLite test that creates a User will assign it an ID of 1 again.  The same second user in PostgreSQL will get an ID of 2.  The tests have been altered to use the database IDs, and in some cases use the correct instance IDs.

One real issue discovered was that version.number was a CHAR(10) field, and was changes to a TEXT field.  SQLite doesn't enforce field sizes, but PostgreSQL does.