Re: OCTET_LENGTH is wrong - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: OCTET_LENGTH is wrong
Date
Msg-id Pine.LNX.4.30.0111202251220.613-100000@peter.localdomain
Whole thread Raw
In response to Re: OCTET_LENGTH is wrong  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: OCTET_LENGTH is wrong
Re: OCTET_LENGTH is wrong
List pgsql-hackers
Tom Lane writes:

> What's bothering me right now is the difference between client and
> server encodings.  It seems that the only plausible use for
> octet_length is to do memory allocation on the client side, and for
> that purpose the length ought to be measured in the client encoding.

OCTET_LENGTH returns the size of its argument, not the size of some
possible future shape of that argument.  There is absolutely no guarantee
that the string that is processed by OCTET_LENGTH will ever reach any kind
of client.  There are procedural languages, for instance, or CREATE TABLE
AS.

Whether or not this behaviour is most likely or most useful is a different
question, but let's not silently readopt standard functions for
non-standard purposes -- we've just gotten past that one.

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: OCTET_LENGTH is wrong
Next
From: Bruce Momjian
Date:
Subject: Re: beta3