From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: OCTET_LENGTH is wrong |
Date: | 2001-11-18 19:17:07 |
Message-ID: | 200111181917.fAIJH7Q02239@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> 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".
>
> Furthermore, the size of the TOAST representation that is returned now is
> just one particular of several intermediate representations. For
> instance, it does not include the VARHDRSZ and it does not include the
> size of the tuple headers when it's stored externally. Thus, this size is
> heavily skewed toward low numbers and doesn't tell you much about either
> the disk end or the user's end.
Yes, good arguments. If we want to implement storage_length at some
later time, I think the compressed length may be appropriate, but for
general use, I think we need to return the uncompressed length,
especially considering that multibyte makes the ordinary 2length return
number of characters, so users need a way to get byte length.
Attached is a patch that makes text return the same value type as char()
and varchar() already do. As Tatsuo pointed out, they were
inconsistent. All the other octet_length() functions look fine so it
was only text that had this problem.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 804 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-11-18 19:20:23 | Re: full outer join bug? |
Previous Message | Tom Lane | 2001-11-18 19:06:40 | Re: OCTET_LENGTH is wrong |