Detecting SQL_ASCII databases
От | Oliver Jowett |
---|---|
Тема | Detecting SQL_ASCII databases |
Дата | |
Msg-id | 414CB84A.2050107@opencloud.com обсуждение исходный текст |
Ответы |
Re: Detecting SQL_ASCII databases
|
Список | pgsql-jdbc |
8.0 backends report the server_encoding value of the database via ParameterStatus during startup. I'd like to use this to detect SQL_ASCII databases and complain loudly. The simplest approach is: if the server reports server_encoding on V3 startup, and it is SQL_ASCII, close the connecton and throw SQLException. Perhaps a nicer approach is to do this on V3 connections: 1) if charSet=foo is specified, send a startup packet with client_encoding = foo, otherwise send client_encoding = UNICODE. Set the actual connection encoding to match client_encoding. 2) if the server reports server_encoding = SQL_ASCII and charSet was not specified, close the connection and throw SQLException. and change the >=7.3 logic in the V2 path to respect charSet if used, for consistency with the 7.2 and V3 paths. This lets users who have SQL_ASCII databases continue to use them by explicitly specifying an encoding to use. We still have some inconsistency in when you get the "this db is SQL_ASCII, go away" class of error but I'm not sure if this is worth fixing. It seems like we'd need an extra roundtrip on connection setup to check it for 7.4 servers. Another issue is whether we should allow charSet to be used when server_encoding != SQL_ASCII. It seems confusing to allow this, but we can only detect it after we've established a connection and set everything up. Should we throw an error, change client_encoding back to UNICODE, or just continue with the specified charSet? Opinions? -O
В списке pgsql-jdbc по дате отправления: