On Windows, it's likely that the needed locale is already installed, it's just named differently than on Unix.
As an example, the following database creation appears to works fine for me with PG9.1 on my Windows XP, with its default locale French_France.1252
and no additional language pack installed that I'd recall.
CREATE DATABASE pldb
ENCODING = 'UTF8'
LC_COLLATE = 'Polish'
LC_CTYPE = 'Polish'
TEMPLATE=template0;
Also, a quick test of the sort order by submitting this query in UTF8 in this newly created database:
select * from (values ('z'), ('ź'), ('ż'), ('s'), ('ś'), ('x'), ('y')) as letters order by 1;
seems to output correct results:
s
ś
x
y
z
ź
ż
Transactions are per-session, i.e. per-connection.
PostgreSQL doesn't support suspending and resuming transactions, so psycopg2 couldn't make them per-cursor unless it implicitly created new connections behind the scenes.
In practice I don't find psycopg2's cursors particularly useful. They can retain result sets if you're not using incremental fetch from the server, but I don't find them good for much else.
Why manually issue begin
and commit
though, rather than using the connection methods for them?
Best Answer
Yes it does support different transaction isolation levels per-connection. You can set the transaction isolation level (as well as the read-only and deferrable status for transactions) for a connection with
SET SESSION CHARACTERISTICS
:You can override per-transaction with
SET TRANSACTION ISOLATION LEVEL
, or as you start a transaction withBEGIN TRANSACTION ISOLATION LEVEL
:The default is set with the
default_transaction_isolation
parameter:See the docs at http://www.postgresql.org/docs/current/static/sql-set-transaction.html