Re: Extended Statistics set/restore/clear functions.

Поиск
Список
Период
Сортировка
От Corey Huinker
Тема Re: Extended Statistics set/restore/clear functions.
Дата
Msg-id CADkLM=c8-U4GLMw5VdeDdfp1ae6BW=PCfEQqAky04iZMbckCFw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Extended Statistics set/restore/clear functions.  (jian he <jian.universality@gmail.com>)
Ответы Re: Extended Statistics set/restore/clear functions.
Список pgsql-hackers
+
+ appendStringInfo(&str, "], \"" PG_NDISTINCT_KEY_NDISTINCT "\": %d}",
+ (int) item.ndistinct);

I’m a bit confused about the part above,
item.ndistinct is double type, we just cast it to int type?

It's a historical quirk. That's what the original output function did in mvdistinct.c, so we maintain compatibility with that. Altering the internal storage type would affect the bytea serialization, which would break binary compatibility.
 
after apply 0004, the below in doc/src/sgml/perform.sgml also need to change?

Yes it does, good catch.
 
Do you think it's worth the trouble to have two separate
appendStringInfoChar for ``{}``?

for example in loop ``for (i = 0; i < ndist->nitems; i++)``. we can change to:

I agree that that feels more symmetrical. However, it seems the prevailing wisdom is that we're already paying for a string interpolation in the very next appendStringInfo(), we might as well save ourselves a function call. Hence, I left that one as-is.

The sgml change has been worked into a rebased and reduced patch set (thanks for the commits Michael!)

Вложения

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