Re: Selecting a constant question
Zeugswetter Andreas DCP SD <zeugswettera@spardat.at>
From: "Zeugswetter Andreas ADI SD" <ZeugswetterA@spardat.at>
To: "Heikki Linnakangas" <heikki@enterprisedb.com>, "Larry McGhaw" <lmcghaw@connx.com>
Cc: "Tom Lane" <tgl@sss.pgh.pa.us>, "Alvaro Herrera" <alvherre@commandprompt.com>, "Dann Corbit" <DCorbit@connx.com>, "Gregory Stark" <stark@enterprisedb.com>, "Martijn van Oosterhout" <kleptog@svana.org>, <pgsql-hackers@postgresql.org>
Date: 2007-06-12T09:37:56Z
Lists: pgsql-hackers
> > Again, *all* other major relational databases do this ... > even blob fields have a maximum length reported from the database. > > So what are you doing with the max length? Not all data types > and values have a meaningful max length, so you have to be > able to deal with variable length data anyway. Imho it has a lot to do with optimizing the interface. If you know, that the max length is e.g. 16 bytes in UTF-8 for the 3 chars, you will probably not want any on the fly allocation smarts and preallocate and bind those 16 bytes. When the max length value gets larger, and it is a variable lenght type, the overhead of varlen allocation smarts starts to pay off. A generic interface should keep the sql parsing smarts at a minimum, thus it cannot know that a returned column is actually a text constant. Imho the request for a max length is very reasonable, but has no value once it exceeds a certain size e.g. 64k. Andreas