Hello I send my first patch for PostgreSQL - maybe ugly patch. This patch generate on top of dump file line with setting of current encoding. Its useful for languages like czech with more than one wide used encoding. We need informations about used encoding.
Regards Pavel Stehule
51a52,53 > static char *pg_encoding_to_char(int encoding); > static void _doSetClientEncoding(ArchiveHandle *AH, const char *encoding); 203a206,211 > * Store current client encoding > */ > > _doSetClientEncoding(AH, > pg_encoding_to_char(PQclientEncoding(AH->connection))); > > /* 1951a1960,1992 > static void > _doSetClientEncoding(ArchiveHandle *AH, const char *encoding) > { > PQExpBuffer cmd = createPQExpBuffer(); > > appendPQExpBuffer(cmd, "SET client_encoding TO "); > > /* > * SQL requires a string literal here. Might as well be correct. > */ > if (encoding && *encoding) > appendStringLiteral(cmd, encoding, false); > else > appendPQExpBuffer(cmd, "DEFAULT"); > appendPQExpBuffer(cmd, ";"); > > if (RestoringToDB(AH)) > { > PGresult *res; > > res = PQexec(AH->connection, cmd->data); > > if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) > die_horribly(AH, modulename, "could not client encoding to > \"%s\": %s", > encoding, > PQerrorMessage(AH->connection)); > > PQclear(res); > } > else > ahprintf(AH, "%s\n\n", cmd->data); > > destroyPQExpBuffer(cmd); > }
---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]