pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Detecting SQL_ASCII databases
Date: Sun, 19 Sep 2004 10:35:54 +1200
Message-ID: <414CB84A.2050107@opencloud.com> (raw)

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



view thread (4+ messages)  latest in thread

Message-ID: <414CB84A.2050107@opencloud.com>
Permalink:  ../414CB84A.2050107@opencloud.com/
Also on:    postgresql.org/message-id/414CB84A.2050107@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com
  Subject: Re: Detecting SQL_ASCII databases
  In-Reply-To: <414CB84A.2050107@opencloud.com>
  References: <414CB84A.2050107@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox