| From: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
|---|---|
| To: | jian he <jian(dot)universality(at)gmail(dot)com> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Tomas Vondra <tomas(at)vondra(dot)me>, pgsql-hackers(at)lists(dot)postgresql(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us |
| Subject: | Re: Extended Statistics set/restore/clear functions. |
| Date: | 2025-11-12 22:21:36 |
| Message-ID: | CADkLM=c8-U4GLMw5VdeDdfp1ae6BW=PCfEQqAky04iZMbckCFw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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 | Content-Type | Size |
|---|---|---|
| v12-0001-Refactor-output-format-of-pg_ndistinct.patch | text/x-patch | 17.2 KB |
| v12-0002-Refactor-output-format-of-pg_dependencies.patch | text/x-patch | 12.1 KB |
| v12-0003-Add-working-input-function-for-pg_ndistinct.patch | text/x-patch | 25.8 KB |
| v12-0004-Add-working-input-function-for-pg_dependencies.patch | text/x-patch | 30.4 KB |
| v12-0005-Expose-attribute-statistics-functions-for-use-in.patch | text/x-patch | 10.7 KB |
| v12-0006-Add-extended-statistics-support-functions.patch | text/x-patch | 166.2 KB |
| v12-0007-Include-Extended-Statistics-in-pg_dump.patch | text/x-patch | 13.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Smith | 2025-11-12 22:31:52 | Re: DOCS: ALTER PUBLICATION - Synopsis for DROP is a bit misleading |
| Previous Message | Bryan Green | 2025-11-12 22:17:21 | Re: [PATCH] O_CLOEXEC not honored on Windows - handle inheritance chain |