From e29b67374e79c9f6d91f19f89b7604944301c7b3 Mon Sep 17 00:00:00 2001 From: Karl Kauc Date: Fri, 27 Nov 2026 10:00:49 +0100 Subject: [PATCH] PostgreSQL_End_to_End: query for the rows per table after a load Shown in the film "Loading FundsXML files": what a load left in the database, replaced rows included. Co-Authored-By: Claude Opus 5.5 --- PostgreSQL_End_to_End/README.md | 2 +- PostgreSQL_End_to_End/queries/10_rows_per_table.sql | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 PostgreSQL_End_to_End/queries/10_rows_per_table.sql diff --git a/PostgreSQL_End_to_End/README.md b/PostgreSQL_End_to_End/README.md index c809ecb..69c8655 100644 --- a/PostgreSQL_End_to_End/README.md +++ b/PostgreSQL_End_to_End/README.md @@ -33,7 +33,7 @@ flowchart LR | [`data/in/`](data/in/) | Six deliveries of a fictional asset manager (below) | | [`data/bad/`](data/bad/) | Four files a loader must not accept | | [`data/expected/`](data/expected/) | The files the generator writes from the loaded data (golden files) | -| [`queries/`](queries/) | The questions of the films: deliveries, what repeats, NAV as known today and before, positions, transactions, documents, templates, access, reconciliation | +| [`queries/`](queries/) | The questions of the films: deliveries, what repeats, NAV as known today and before, positions, transactions, documents, templates, access, reconciliation, rows per table | | [`run_all.sh`](run_all.sh) | The whole chain end to end; CI runs exactly this | | [`tools/xsd11/`](tools/xsd11/) | XSD 1.1 validation with Xerces-J 2.12.2 (jars from Maven Central, checked by SHA-1) | diff --git a/PostgreSQL_End_to_End/queries/10_rows_per_table.sql b/PostgreSQL_End_to_End/queries/10_rows_per_table.sql new file mode 100644 index 0000000..1032659 --- /dev/null +++ b/PostgreSQL_End_to_End/queries/10_rows_per_table.sql @@ -0,0 +1,13 @@ +-- What a load left in the database: rows per table (replaced rows included: nothing is overwritten). +SELECT t AS table_name, n AS rows +FROM (VALUES ('delivery', (SELECT count(*) FROM delivery)), + ('fund', (SELECT count(*) FROM fund)), + ('share_class', (SELECT count(*) FROM share_class)), + ('nav', (SELECT count(*) FROM nav)), + ('price', (SELECT count(*) FROM price)), + ('portfolio', (SELECT count(*) FROM portfolio)), + ('position', (SELECT count(*) FROM position)), + ('asset', (SELECT count(*) FROM asset)), + ('trade', (SELECT count(*) FROM trade)), + ('document', (SELECT count(*) FROM document)), + ('regulatory_report', (SELECT count(*) FROM regulatory_report))) AS v (t, n);