diff options
author | Tom Lane | 2007-12-12 21:41:47 +0000 |
---|---|---|
committer | Tom Lane | 2007-12-12 21:41:47 +0000 |
commit | df4271fedd3a3428ffafb9c2cff7de37e13976a0 (patch) | |
tree | 7bae4d81aa5a895c4a9402428f500992f700bc2a /src/bin/psql/print.h | |
parent | 286049dbe4e2763412ef71f62c61b2b297aed6cc (diff) |
Improve the method of localizing column names and other fixed strings in
psql's \d commands and other uses of printQuery(). Previously we would pass
these strings through gettext() and then send them to the server as literals
in the SQL query. But the code was not set up to handle doubling of quotes in
the strings, causing failure if a translation attempted to use the wrong kind
of quote marks, as indeed is now the case for (at least) the French
translation of \dFp. Another hazard was that gettext() would translate to
whatever encoding was implied by the client's LC_CTYPE setting, which might be
different from the client_encoding setting, which would probably cause the
server to reject the query as mis-encoded. The new arrangement is to send the
untranslated ASCII strings to the server, and do the translations inside
printQuery() after the query results come back. Per report from Guillaume
Lelarge and subsequent discussion.
Diffstat (limited to 'src/bin/psql/print.h')
-rw-r--r-- | src/bin/psql/print.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bin/psql/print.h b/src/bin/psql/print.h index 8c1537762ac..cfe9a17a02c 100644 --- a/src/bin/psql/print.h +++ b/src/bin/psql/print.h @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2007, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/print.h,v 1.33 2007/01/05 22:19:49 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/print.h,v 1.34 2007/12/12 21:41:47 tgl Exp $ */ #ifndef PRINT_H #define PRINT_H @@ -67,7 +67,6 @@ void printTable(const char *title, const char *const * headers, const printTableOpt *opt, FILE *fout, FILE *flog); - typedef struct _printQueryOpt { printTableOpt topt; /* the options above */ @@ -76,6 +75,8 @@ typedef struct _printQueryOpt char *title; /* override title */ char **footers; /* override footer (default is "(xx rows)") */ bool default_footer; /* print default footer if footers==NULL */ + bool trans_headers; /* do gettext on column headers */ + const bool *trans_columns; /* trans_columns[i-1] => do gettext on col i */ } printQueryOpt; /* |