Re: Proposed patch to avoid translation risks in psql's \d commands

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgreSQL(dot)org
Subject: Re: Proposed patch to avoid translation risks in psql's \d commands
Date: 2007-12-12 18:03:43
Message-ID: 4760227F.6040201@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane a écrit :
> 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.
>

It does resolve it. I applied your patch on my CVS HEAD checkout and it
works just great.

> 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?
>

I have no problem with this. Other strings are not available for
translation (for example RECORD # when using the \x command) and that's
not really a big deal.

Thanks.

Regards.

--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2007-12-12 21:13:14 archiver ps display
Previous Message Pavel Stehule 2007-12-12 16:23:32 result of convert_to is bytea