Re: (repost) pgtcl: restore 8.0 compatibility for large obj fix - Mailing list pgsql-patches

From ljb
Subject Re: (repost) pgtcl: restore 8.0 compatibility for large obj fix
Date
Msg-id boeqm2$2l10$1@news.hub.org
Whole thread Raw
In response to (repost) pgtcl: restore 8.0 compatibility for large obj fix  (ljb <ljb220@mindspring.com>)
Responses Re: (repost) pgtcl: restore 8.0 compatibility for large obj fix  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
tgl@sss.pgh.pa.us wrote:
> ljb <ljb220@mindspring.com> writes:
>> +#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1 || TCL_MAJOR_VERSION > 8
>> +    bufObj = Tcl_NewByteArrayObj(buf, nbytes);
>> +#else
>>      bufObj = Tcl_NewStringObj(buf, nbytes);
>> +#endif
>
> Hmm.  We could certainly do it like that, but does this actually fix the
> problem for Tcl 8.0.*?  Or will the unwanted character set translation
> happen anyway in that version?  I don't see any value in letting the
> code compile against 8.0.* if the behavior will be wrong ...


What I wrote was:

>> I don't think Tcl 8.0.x will have the problem with binary data, as the
>> trouble started with internationalization at 8.1.

Meaning: Tcl 8.0 added "binary strings", and handled binary data in String
objects.  Tcl 8.1 internationalized those strings to make them store UTF-8,
and introduced ByteArray objects to hold binary data. So the original code
should work fine in Tcl 8.0, and the changes are only needed at 8.1 and up.
I'm guessing, though, so I'll go dust off a copy of Tcl 8.0.x and try it.

pgsql-patches by date:

Previous
From: Gaetano Mendola
Date:
Subject: Re: equal() perf tweak
Next
From: Tom Lane
Date:
Subject: Re: (repost) pgtcl: restore 8.0 compatibility for large obj fix