Re: Extended Statistics set/restore/clear functions. - Mailing list pgsql-hackers

From Corey Huinker
Subject Re: Extended Statistics set/restore/clear functions.
Date
Msg-id CADkLM=c8-U4GLMw5VdeDdfp1ae6BW=PCfEQqAky04iZMbckCFw@mail.gmail.com
Whole thread Raw
In response to Re: Extended Statistics set/restore/clear functions.  (jian he <jian.universality@gmail.com>)
Responses Re: Extended Statistics set/restore/clear functions.
List 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!)

Attachment

pgsql-hackers by date:

Previous
From: Bryan Green
Date:
Subject: Re: [PATCH] O_CLOEXEC not honored on Windows - handle inheritance chain
Next
From: Peter Smith
Date:
Subject: Re: DOCS: ALTER PUBLICATION - Synopsis for DROP is a bit misleading