Re: OCTET_LENGTH is wrong

From: Barry Lind <barry(at)xythos(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: OCTET_LENGTH is wrong
Date: 2001-11-19 17:43:56
Message-ID: 3BF944DC.2040701@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom,

While the text datatypes have additional issues with encodings, that is
not true for the bytea type. I think it does make sense that a client
be able to get the size in bytes that the bytea type value will return
to the client. If you are storing files in a bytea column getting the
file size by calling octet_length would be very useful.

thanks,
--Barry

Tom Lane wrote:

> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>
>>I think "the value of S" implies "the user-accessible representation of
>>the value of S", in the sense, "How much memory do I need to allocate to
>>store this value".
>>
>
> If I take that argument seriously, I have to conclude that OCTET_LENGTH
> should return the string length measured in the current client encoding
> (which may have little to do with its size in the server, if the
> server's encoding is different). If the client actually retrieves the
> string then that's how much memory he'll need.
>
> I presume that where you want to come out is OCTET_LENGTH = uncompressed
> length in the server's encoding ... but so far no one has really made
> a convincing argument why that answer is better or more spec-compliant
> than any other answer. In particular, it's not obvious to me why
> "number of bytes we're actually using on disk" is wrong.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-11-19 17:54:28 Re: Further open item (Was: Status of 7.2)
Previous Message Sergio Pili 2001-11-19 17:38:26 Re: WAS: [Fwd: PostgreSQL new commands proposal]