Re: pg_class catalog question... - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: pg_class catalog question...
Date
Msg-id 9C427E2D-0EB2-4DA3-AB7F-8ECEC1DA29A2@pervasive.com
Whole thread Raw
In response to Re: pg_class catalog question...  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_class catalog question...  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
On Apr 2, 2006, at 6:13 PM, Tom Lane wrote:

> "Jonah H. Harris" <jonah.harris@gmail.com> writes:
>> On 4/2/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> If you're expecting that you'll be able to write BYTEA(n) and avoid
>>> storing a length word, you'll find that it's not a trivial matter.
>
>> It may not be trivial, but it's certainly not impossible.
>
> A word to the wise is sufficient: function result types don't have
> known typmods, and for the most part expression results don't either.
> Changing that is not "impossible", but the level of pain vastly  
> exceeds
> what this feature would be worth.  And that's not even the only
> problem.
>
> If you're desperate to have something like this, you could create one
> or more fixed-size datatypes (ie, with various positive typlen  
> values).
> But I don't see a practical way to use a typmod in determining the
> physical width.

I'm not sure how other databases handle this, but I suspect it would  
be OK performance-wise to tack on a length byte for these types when  
dealing with functions and anything else that isn't directly tied to  
a table where you can easily get length info from the catalog.

Actually, how is this handled with varchar(x)?
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461




pgsql-hackers by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: semaphore usage "port based"?
Next
From: Stephen Frost
Date:
Subject: Re: semaphore usage "port based"?