nasbyj / catalog_entities

Entities that exist in various versions of the Postgres catalog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is it?

catalog between different versions.

Why would I wast this?

This is handy for creating tools that need to work across multiple versions of Postgres. It is especially useful in supporting code generation based on catalog metadata.

Installing

Dependencies

catalog_entities depends on the cat_tools extension. The simplest way to install it is:

# Install pgxn if it doesn't exist
which pgxn > /dev/null || sudo -H pip install pgxnclient
# Now install cat_tools
pgxn install cat_tools

Install

load.sh will create a new Postgres database with full catalog information. It requires the name of a database. It also accepts any psql options that also work with dropdb and createdb.

Warning
load.sh will drop the specified database if it already exists!

Example:

./load.sh catalog_entities

Provided data

catalog_relations is the raw table that contains catalog attribute information for each version.

latest lists information for the most recent version in catalog_relations. latest_expanded explodes the attribute information, providing one row for every attribute in every relation, instead of one row per relation.

current_version_delta and current_version_relation both inspect the catalog tables in the database. These are "live" and their contents depend on the version of Postgres that the database is running in. They are used by other scripts to update catalog_relations.

About

Entities that exist in various versions of the Postgres catalog

License:MIT License


Languages

Language:Shell 57.7%Language:PLpgSQL 42.3%