On Sun, Aug 15, 2010 at 10:20 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Sun, Aug 15, 2010 at 7:49 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> FWIW, I *don't* like this version, specifically because it fails to
>>> utilize the pg_wchar datatype. The function in question is neither big
>>> enough nor mutable enough that it's urgent to not duplicate it between
>>> the backend and psql, so I don't see much value in moving it to src/port.
>
>> Well, we'd better at least add a comment noting that the two versions
>> should match. But I think it would be better to unify them. However,
>> in the back-branches, I'd just fix the incorrect copy.
>
> Yeah, I did the latter part already because I figured it was
> uncontroversial. What to do in HEAD is still under debate.
>
> As for "the two versions should match", the only way they'd be likely to
> diverge would be if the requirements change on one end or the other.
> It's not unreasonable to suppose, for example, that we might want the
> backend's version to start throwing an elog instead of just returning
> -1 for a bad character. It would be a lot harder to do that if we've
> pushed the code into src/port.
Not really. You'd just write a wrapper to call the version in
src/port and then elog if it returned -1. Unless -1 is actually a
valid result, I guess.
Anyway, it's not really important enough to me to have a protracted
argument about it. Let's wait and see if anyone else has an opinion,
and perhaps a consensus will emerge.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company