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

From Martijn van Oosterhout
Subject Re: pg_class catalog question...
Date
Msg-id 20060404052054.GA32226@svana.org
Whole thread Raw
In response to Re: pg_class catalog question...  (Jim Nasby <jnasby@pervasive.com>)
List pgsql-hackers
On Mon, Apr 03, 2006 at 01:31:50PM -0400, Jim Nasby wrote:
> 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)?

By storing the length in the Datum.

This discussion as about whether we could support something like HEX(n)
without storing the (n) in the data field but only in the catalog.
varchar(n) doesn't have this issue because we always store the length,
so everywhere that needs to know already does.

If your not worried about the length field you could code this up in an
afternoon. In fact, it's probably already been done...
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Fixing domain input
Next
From: Andrew Dunstan
Date:
Subject: Re: Suggestion: Which Binary?