Re: hstore improvements?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: hstore improvements?
Date: 2009-03-13 20:12:04
Message-ID: 4661.1236975124@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"David E. Wheeler" <david(at)kineticode(dot)com> writes:
> On Mar 13, 2009, at 11:06 AM, Andrew Gierth wrote:
>> Also, hstore has an (undocumented) limit of 65535 bytes for keys and
>> values, and it does not behave very cleanly when given longer values
>> (it truncates them mod 2^16, rather than erroring). That gives rise to
>> two obvious questions: (1) are those lengths reasonable? they strike
>> me as being rather long for keys and rather short for values; and (2)
>> should exceeding the lengths throw an error?

> I agree. The keys can be much shorter without any threat of loss. Can
> the value not essentially be TEXT, and thus theoretically unlimited in
> size?

Well, TEXT is limited to 1GB by the toastable-datum rules, as is the
whole hstore datum, so there's no point in worrying about "huge"
values. I agree though that 64K is on the small side for a data limit.
If we wanted to keep the lengths in the same 32 bits they presumably
occupy now, what about splitting 8/24 (=> 255 bytes for key, 24MB for
value)?

As for truncation rather than throwing an error, I'd argue that that's
a flat-out bug and the fix deserves back-patching.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2009-03-13 20:21:51 Re: hstore improvements?
Previous Message Tom Lane 2009-03-13 20:06:48 Re: hstore improvements?