SKalt / pg_inventory

pg_catalog queries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pg_inventory

pg_catalog queries

This contains SQL long-form queries generated from Go templates. Each SQL query is tested against a number of example databases.

Directory structure

.
├── pkg
│   └── internal
│       └── test/*.go
├── scripts
│   ├── */*.go
│   └── *.sh
├── bin/*
├── sample_dbs/*.dump.sql
├── db_object_kinds/${kind}
│   ├── ${template_name}.sql.tpl
│   ├── ${template_name}.params.toml
│   └── ${query_name}
│        ├── query.sql
│        └── tests/${sample_db_name}/${test_case_name}
│            ├── params.toml
│            ├── explain.yaml
│            └── results.tsv
├── Makefile
└── README.md

Naming Conventions

  1. queries named like ${thing}_normalized/query.sql preserve oids, while queries named like ${thing}_denormalized/query.sql join other catalogs for object names and do not contain any oids. This is important for testing, since oids aren't stable across different instantiations of the same schema in a fresh server.
  2. pg_namespace is always joined AS ns and referenced as ns.nspname AS schema_name.
  3. comments are always fetched AS "comment".

Database Object Kinds

About

pg_catalog queries

License:Apache License 2.0


Languages

Language:PLpgSQL 68.1%Language:Smarty 23.7%Language:Go 5.6%Language:Makefile 2.2%Language:Shell 0.4%