X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fpsql-reader.c;h=85e777a991b9218bfbf2c5f17555a9972093bd5e;hb=537fdeb3702c011e05d7826a8d556a7beeba2605;hp=be6d0a60759c45746ea01b660ca35e8f1770064b;hpb=7fbfc32fc3c636959b0a25b3e76609f86519e84a;p=pspp-builds.git diff --git a/src/data/psql-reader.c b/src/data/psql-reader.c index be6d0a60..85e777a9 100644 --- a/src/data/psql-reader.c +++ b/src/data/psql-reader.c @@ -288,10 +288,22 @@ psql_open_reader (struct psql_read_info *info, struct dictionary **dict) /* Create the dictionary and populate it */ *dict = r->dict = dict_create (); + { + const int enc = PQclientEncoding (r->conn); + + /* According to section 22.2 of the Postgresql manual + a value of zero (SQL_ASCII) indicates + "a declaration of ignorance about the encoding". + Accordingly, we don't set the dictionary's encoding + if we find this value. + */ + if ( enc != 0 ) + dict_set_encoding (r->dict, pg_encoding_to_char (enc)); + } + /* select count (*) from (select * from medium) stupid_sql_standard; */ - ds_init_cstr (&query, "BEGIN READ ONLY ISOLATION LEVEL SERIALIZABLE; " "DECLARE pspp BINARY CURSOR FOR ");