Re: pg_do_encoding_conversion glitch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_do_encoding_conversion glitch
Date: 2008-11-10 13:38:23
Message-ID: 3476.1226324303@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> writes:
> I have a question about the result contract of pg_do_encoding_conversion().

It's poorly designed :-(

As near as I can tell, all uses of the function either pass a
null-terminated string or special-case the result == src case in such a
way that it doesn't matter. However it's certainly not obvious that you
have to do that.

The calls in contrib/sslinfo might be broken --- not sure how much
that module has been tested.

Do you have a proposal for a different API, or do you just want to
improve the comment for the function? Bear in mind that a lot of the
callers do know the string length, and so we shouldn't impose an
unnecessary strlen() operation on those cases.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hitoshi Harada 2008-11-10 13:48:23 Re: Windowing Function Patch Review -> Standard Conformance
Previous Message Zdenek Kotala 2008-11-10 13:26:36 Re: WIP: Page space reservation (pgupgrade)