From: | "Vadim B(dot) Mikheev" <vadim(at)sable(dot)krasnoyarsk(dot)su> |
---|---|
To: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>, hackers(at)postgresql(dot)org |
Subject: | Re: [HACKERS] Re: varchar() troubles (fwd) |
Date: | 1998-01-16 09:31:45 |
Message-ID: | 34BF2901.C9DFE5B9@sable.krasnoyarsk.su |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Bruce Momjian wrote:
>
> > >
> > > Can I add an 'attdeflen' for "attributed defined length" field to
> > > pg_attribute, and change the attlen references needed to the new field?
> > > This is the only proper way to fix it.
> >
> > Bruce, does your "temporary fix" seem to repair all known problems with varchar()? If so, would you be interested in
> > holding off on a "proper fix" and coming back to it after v6.3 is released? At that time, we can try solving the general
> > problem of retaining column-specific attributes, such as your max len for varchar, declared dimensions for arrays, and
> > numeric() and decimal() types. Or, if you have time to try a solution now _and_ come back to it later...
> >
>
> In fact, I am inclined to leave attlen unchanged, and add atttyplen that
> is a copy of the length of the type. That way, the attlen for varchar()
> really contains the defined length, and atttyplen is used for disk
> references, and it is very clear what it means.
pg_attribute.h:
int2 attlen;
/*
* attlen is a copy of the typlen field from pg_type for this
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* attribute...
^^^^^^^^^
: I would suggest to don't change this to preserve the same meaning
for all data types. attlen = -1 means that attribute is varlena.
We certainly need in new field in pg_attribute! I don't like names like
"attdeflen" or "atttyplen" - bad names for NUMERIC etc. Something like
atttspec (ATTribute Type SPECification) is better, imho.
For the varchar(N) we'll have attlen = -1 and atttspec = N (or N + 4 - what's
better). For the text: attlen = -1 and atttspec = -1. And so on.
Of 'course, it's not so much matter where to put maxlen of varchar.
attlen = -1 for varchar just seems more clear to me.
But in any case we need in new field and, imho, this should be added
in 6.3
Vadim
From | Date | Subject | |
---|---|---|---|
Next Message | Zeugswetter Andreas DBT | 1998-01-16 09:33:00 | Re: [HACKERS] Re: New pg_pwd patch and stuff |
Previous Message | bas aerts | 1998-01-16 09:29:31 | (no subject) |