-- Test that USER_TABLES / USER_TAB_COLUMNS describe only the current user's -- objects, not every table in the database. \set ECHO none CREATE SCHEMA orafce_user_tables; SET search_path TO orafce_user_tables, oracle; CREATE TABLE ut_one (id int, note text); CREATE TABLE ut_two (id int); CREATE VIEW ut_view AS SELECT id FROM ut_one; ---- -- USER_TABLES lists the current schema's base tables, and only those. A view -- is not a table, so ut_view is absent. ---- SELECT table_name FROM user_tables ORDER BY 1; table_name ------------ ut_one ut_two (2 rows) ---- -- No PostgreSQL catalog table may appear: they are not owned by this user. -- Before the current-schema restriction this count was in the dozens. ---- SELECT count(*) FROM user_tables WHERE table_name LIKE 'pg=_%' ESCAPE '='; count ------- 0 (1 row) ---- -- USER_TAB_COLUMNS is restricted the same way, so it describes exactly the -- columns of the tables above. ---- SELECT table_name, column_name, column_id FROM user_tab_columns WHERE table_name IN ('ut_one', 'ut_two') ORDER BY table_name, column_id; table_name | column_name | column_id ------------+-------------+----------- ut_one | id | 1 ut_one | note | 2 ut_two | id | 1 (3 rows) SELECT count(*) FROM user_tab_columns WHERE table_name LIKE 'pg=_%' ESCAPE '='; count ------- 0 (1 row) DROP SCHEMA orafce_user_tables CASCADE; SET search_path TO public, oracle;