From 52c696f199c26089a4590712c451fbbe5c32439c Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Sat, 3 Mar 2018 12:07:05 -0500 Subject: [PATCH] list all keys and types --- reports/key_list.sql | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 reports/key_list.sql diff --git a/reports/key_list.sql b/reports/key_list.sql new file mode 100644 index 0000000..e69a8cb --- /dev/null +++ b/reports/key_list.sql @@ -0,0 +1,24 @@ +\timing + +WITH ok AS ( + SELECT + srce, + ok.k, + jsonb_typeof(allj->ok.k) typeof, + COUNT(*) + FROM + tps.trans + JOIN LATERAL jsonb_object_keys(allj) ok(k) ON TRUE + GROUP BY + srce, + ok.k, + jsonb_typeof(allj->ok.k) + ORDER BY + srce +) +SELECT + srce + ,k + ,typeof +FROM + ok \ No newline at end of file