Fix and clean up db/relation/tablespace size functions.
This fixes several small bugs:
- Schema-qualify the functions in all queries.
- Quote database and tablespace names correctly in the dispatched
queries.
- In the variants that take OID, also dispatch the OID rather than the
resolved name. This avoids having to deal with quoting schema and table
names in the query, and seems like the right thing to do anyway.
- Dispatch pg_table_size() pg_indexes_size() variants. These were added
in PostgreSQL 9.0, but we missed modifying them in the merge, the same
way that we have modified all the other variants.
Also, refactor the internal function used to dispatch the pg_*_size()
calls to use CdbDispatchCommand directly, instead of using SPI and the
gp_dist_random('gp_id') trick. Seems more straightforward, although I
believe that trick should've worked, too.
Add tests. We didn't have any bespoken tests for these functions, although
we used some of the variants in other tests.
Reviewed-by: NDaniel Gustafsson <dgustafsson@pivotal.io>
Showing
想要评论请 注册 或 登录