Re: stawidth inconsistency with all NULL columns

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: stawidth inconsistency with all NULL columns
Дата
Msg-id 15583.1558468505@sss.pgh.pa.us
обсуждение исходный текст
Ответ на stawidth inconsistency with all NULL columns  (Joe Conway <mail@joeconway.com>)
Ответы Re: stawidth inconsistency with all NULL columns  (Joe Conway <mail@joeconway.com>)
Список pgsql-hackers
Joe Conway <mail@joeconway.com> writes:
> else if (null_cnt > 0)
> {
>     /* We found only nulls; assume the column is entirely null */
>     stats->stats_valid = true;
>     stats->stanullfrac = 1.0;
>     if (is_varwidth)
>         stats->stawidth = 0;    /* "unknown" */
>     else
>         stats->stawidth = stats->attrtype->typlen;
>     stats->stadistinct = 0.0;       /* "unknown" */
> }
> 8<-----------------

> So apparently intentional, but seems gratuitously inconsistent. Could
> this cause any actual inconsistent behaviors? In any case that first
> comment does not reflect the code.

Are you suggesting that we should set stawidth to zero even for a
fixed-width datatype?  That seems pretty silly.  We know exactly what
the value should be, and would be if we'd chanced to find even one
non-null entry.

            regards, tom lane



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

Предыдущее
От: Joe Conway
Дата:
Сообщение: stawidth inconsistency with all NULL columns
Следующее
От: Andres Freund
Дата:
Сообщение: Re: PG 12 draft release notes