Re: [HACKERS] Re: varchar() troubles (fwd)

Поиск
Список
Период
Сортировка
От Vadim B. Mikheev
Тема Re: [HACKERS] Re: varchar() troubles (fwd)
Дата
Msg-id 34BF2901.C9DFE5B9@sable.krasnoyarsk.su
обсуждение исходный текст
Ответ на Re: [HACKERS] Re: varchar() troubles (fwd)  (Bruce Momjian <maillist@candle.pha.pa.us>)
Ответы Re: [HACKERS] Re: varchar() troubles (fwd)  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список 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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: bas aerts
Дата:
Сообщение: (no subject)
Следующее
От: Zeugswetter Andreas DBT
Дата:
Сообщение: Re: [HACKERS] Re: New pg_pwd patch and stuff