postgresql/src/include
Michael Paquier e76defbcf0 Rework output format of pg_dependencies
The existing format of pg_dependencies uses a single-object JSON
structure, with each key value embedding all the knowledge about the
set attributes tracked, like:
{"1 => 5": 1.000000, "5 => 1": 0.423130}

While this is a very compact format, it is confusing to read and it is
difficult to manipulate the values within the object, particularly when
tracking multiple attributes.

The new output format introduced in this commit is a JSON array of
objects, with:
- A key named "degree", with a float value.
- A key named "attributes", with an array of attribute numbers.
- A key named "dependency", with an attribute number.

The values use the same underlying type as previously when printed, with
a new output format that shows now as follows:
[{"degree": 1.000000, "attributes": [1], "dependency": 5},
 {"degree": 0.423130, "attributes": [5], "dependency": 1}]

This new format will become handy for a follow-up set of changes, so as
it becomes possible to inject extended statistics rather than require an
ANALYZE, like in a dump/restore sequence or after pg_upgrade on a new
cluster.

This format has been suggested by Tomas Vondra.  The key names are
defined in the header introduced by 1f927cce44, to ease the
integration of frontend-specific changes that are still under
discussion.  (Again a personal note: if anybody comes up with better
name for the keys, of course feel free.)

The bulk of the changes come from the regression tests, where
jsonb_pretty() is now used to make the outputs generated easier to
parse.

Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com
2025-11-17 10:44:26 +09:00
..
access Fix incorrect function name in comments 2025-11-15 12:27:42 +02:00
archive Update copyright for 2025 2025-01-01 11:21:55 -05:00
backup Add backup_type column to pg_stat_progress_basebackup. 2025-08-05 10:50:45 -07:00
bootstrap Allow redeclaration of typedef yyscan_t 2025-09-12 08:16:00 +02:00
catalog Split out innards of pg_tablespace_location() 2025-11-12 16:39:55 +01:00
commands Fix bug where we truncated CLOG that was still needed by LISTEN/NOTIFY 2025-11-12 20:59:36 +02:00
common Replace off_t by pgoff_t in I/O routines 2025-11-13 12:41:40 +09:00
datatype Avoid using timezone Asia/Manila in regression tests. 2025-01-20 15:47:53 -05:00
executor Change "long" numGroups fields to be Cardinality (i.e., double). 2025-11-02 16:57:43 -05:00
fe_utils Add \pset options for boolean value display 2025-11-03 17:40:39 +01:00
foreign Improve ExplainState type handling in header files 2025-09-15 11:04:10 +02:00
jit jit: Fix type used for Datum values in LLVM IR. 2025-09-17 13:38:35 +12:00
lib Add pairingheap_initialize() for shared memory usage 2025-11-05 11:44:13 +02:00
libpq Replace pg_restrict by standard restrict 2025-10-29 07:52:58 +01:00
mb Use C11 char16_t and char32_t for Unicode code points. 2025-10-29 14:17:13 -07:00
nodes Implement WAIT FOR command 2025-11-05 11:44:13 +02:00
optimizer Change "long" numGroups fields to be Cardinality (i.e., double). 2025-11-02 16:57:43 -05:00
parser Implement WAIT FOR command 2025-11-05 11:44:13 +02:00
partitioning Mark function arguments of type "Datum *" as "const Datum *" where possible 2025-10-31 10:47:25 +01:00
pch meson: Increase minimum version to 0.57.2 2025-07-02 11:14:53 +02:00
port Replace off_t by pgoff_t in I/O routines 2025-11-13 12:41:40 +09:00
portability Update copyright for 2025 2025-01-01 11:21:55 -05:00
postmaster Add log_autoanalyze_min_duration 2025-10-15 14:31:12 +02:00
regex pg_regc_locale.c: rename some static functions. 2025-10-14 11:04:04 -07:00
replication Add sequence synchronization for logical replication. 2025-11-05 05:59:58 +00:00
rewrite Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
snowball Update to latest Snowball sources. 2025-02-18 21:13:54 -05:00
statistics Rework output format of pg_dependencies 2025-11-17 10:44:26 +09:00
storage Replace off_t by pgoff_t in I/O routines 2025-11-13 12:41:40 +09:00
tcop Implement WAIT FOR command 2025-11-05 11:44:13 +02:00
tsearch Update copyright for 2025 2025-01-01 11:21:55 -05:00
utils Get rid of long datatype in CATCACHE_STATS enabled builds 2025-11-17 12:26:41 +13:00
.gitignore Use <stdint.h> and <inttypes.h> for c.h integers. 2024-12-04 15:05:38 +13:00
c.h Adjust MemSet macro to use size_t rather than long 2025-11-17 12:27:00 +13:00
fmgr.h Change fmgr.h typedefs to use original names 2025-09-15 11:04:10 +02:00
funcapi.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
getopt_long.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
Makefile Clean up newly added guc_tables.inc.c 2025-09-04 17:25:43 +02:00
meson.build meson: add and use stamp files for generated headers 2025-08-11 15:18:23 -04:00
miscadmin.h Avoid mixing void and integer in a conditional expression. 2025-11-02 12:30:44 -05:00
pg_config.h.in Re-run autoheader 2025-11-06 07:37:22 +01:00
pg_config_manual.h Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h 2025-11-10 16:11:41 +02:00
pg_getopt.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
pg_trace.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
pgstat.h Add seq_sync_error_count to subscription statistics. 2025-11-07 08:05:08 +00:00
pgtar.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
pgtime.h Seek zone abbreviations in the IANA data before timezone_abbreviations. 2025-01-16 14:11:19 -05:00
port.h Add timingsafe_bcmp(), for constant-time memory comparison 2025-04-02 15:32:40 +03:00
postgres.h Grab the low-hanging fruit from forcing USE_FLOAT8_BYVAL to true. 2025-08-13 17:18:22 -04:00
postgres_ext.h Move pg_int64 back to postgres_ext.h 2025-09-16 10:48:56 +02:00
postgres_fe.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
varatt.h Convert varatt.h access macros to static inline functions. 2025-08-05 17:01:25 +02:00
windowapi.h Add IGNORE NULLS/RESPECT NULLS option to Window functions. 2025-10-03 09:47:36 +09:00