Clean-up Catalog Infrastructure #1398
Description
Our catalog code is a mess. It's inconsistent. We need to clean it up so that it is easier to understand and follows the proper logical hierarchy.
I propose the following changes:
-
Refactor the methods so that
TransactionContext
is always passed in as the first argument. -
Refactor the
Catalog
methods so that parameters are passed in using the same order as the hierarchy (i.e., Database→Schema→Table). I think that Indexes should be under Table as well. Right now they are under Databases. -
DatabaseCatalogObject
should not allow you to getTableCatalogObject
.DatabaseCatalogObject
should only allow you to getSchemaCatalogObject
and then all of the tables should be stored inSchemaCatalogObject
instead. -
A more controversial move would be to rename
SchemaCatalogObject
toNamespaceCatalogObject
. Postgres exposes this aspg_namespace
. I think we should switch.