From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-patches(at)postgreSQL(dot)org |
Subject: | Proposed patch to avoid translation risks in psql's \d commands |
Date: | 2007-12-12 02:52:24 |
Message-ID: | 10693.1197427944@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
I proposed here:
http://archives.postgresql.org/pgsql-hackers/2007-12/msg00436.php
that we change the way that psql deals with localization of column
names and other fixed strings in the output of \d and related commands
(basically, anything that calls printQuery()). Specifically, we should
avoid shipping already-translated strings to the server, because they
might not be in the expected encoding and also might contain quote
marks, which the existing code doesn't guard against. We can instead
apply the gettext() conversion when the query results come back from
the server.
The attached patch does this, and seems to resolve Guillaume Lelarge's
original complaint.
I found just one place where the proposed new method doesn't work quite
as nicely as the old. In \dC (describe casts), the Function column
contains either a function name or '(binary compatible)' to indicate
a cast WITHOUT FUNCTION. The existing code is able to localize '(binary
compatible)', but this patch does not, because applying gettext to every
value in the column seems to pose an unacceptably high risk of
"translating" some function name that happens to match a string in
psql's .PO database.
I'm inclined to just live with that, since it seems a relatively minor
deficiency, but I wonder if anyone has a better idea how to do it?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 46.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2007-12-12 13:40:52 | DDL in EDB-SPL |
Previous Message | Magnus Hagander | 2007-12-11 14:35:13 | Re: [HACKERS] Problem with ControlFileData structure being ABI depe ndent |