AbsaOSS / ultet

Database deployment tool
Apache License 2.0
3 stars 0 forks source link

Creating table class from Postgres system files #13

Closed benedeki closed 7 months ago

benedeki commented 1 year ago

Background

Tables need to be represented within the application for further analysis and eventually change SQL entries

Feature

The table class is to be filled from Postgres system tables.

NB! Function to return Option of the table class, in case the table does not exist (then None is returned)

Hint

This is for functions, but query or table won't be that different.

SELECT
    n.nspname,
    A.rolname,
    T.typname AS returntype,
    p.*

FROM 
    pg_catalog.pg_namespace n JOIN 
    pg_catalog.pg_proc p ON p.pronamespace = n.oid JOIN
    pg_catalog.pg_authid A ON  p.proowner  = A.oid JOIN
    pg_catalog.pg_type T ON p.prorettype = T.oid
WHERE   
    n.nspname NOT IN ('public', 'pg_catalog', 'pg_toast', 'information_schema') AND
    p.prokind = 'f'
ORDER BY n.nspname, p.proname

Depends on AbsaOSS/fa-db#8`2

benedeki commented 1 year ago

This item depends on: