Я створив таблицю donorв схемі referenceвідповідно до:
CREATE TABLE reference.donor (
donor_code smallint PRIMARY KEY,
donor_name character varying NOT NULL,
donor_type smallint REFERENCES reference.donor_type (type_id),
alpha_2_code char(2) REFERENCES reference.iso_3166_1 (alpha_2_code)
);
Я заповнив таблицю відповідно до:
INSERT INTO reference.donor (donor_code, donor_name, donor_type, alpha_2_code)
SELECT donor_code, donor_name, donor_type, alpha_2_code
FROM reference.donor_template;
Коли я бігаю:
\dt+ reference.*
всередині psql я бачу reference.donorтаблицю:
List of relations
Schema | Name | Type | Owner | Size | Description
-----------+----------------+-------+----------+-------+-------------
reference | donor | table | postgres | 16 kB |
reference | donor_template | table | postgres | 16 kB |
reference | donor_type | table | postgres | 16 kB |
reference | iso_3166_1 | table | postgres | 48 kB |
(4 rows)
Але коли я біжу \dt+ donor*(або \dt(+)), я не бачу reference.donorтаблиці:
List of relations
Schema | Name | Type | Owner | Size | Description
-----------+----------------+-------+----------+-------+-------------
oecd_cl | donor | table | postgres | 16 kB |
reference | donor_template | table | postgres | 16 kB |
reference | donor_type | table | postgres | 16 kB |
(3 rows)
Чому я бачу reference.donorтаблицю лише в тому випадку, коли бігаю \dt+ reference.*або \dt+ *.donor?
Я очікував \dt(або \dt+) показати його, але це не так.
Моя search_pathвключає схему, referenceі користувач postgresмає всі дозволи на схему referenceта всі таблиці в схемі відповідно до:
GRANT ALL ON ALL TABLES IN SCHEMA reference TO postgres;
Просто для уточнення, у мене є дві donorтаблиці, але вони є у двох різних схемах, тобто oecd.donor& reference.donor. (Я можу бачити oecd.donorбез проблем, коли я використовую \dt(+)всередині psql).
search_pathпершій і не знаючи назви таблиць / схем заздалегідь? Або я краще запитуюinformation schemaнапр .:,SELECT table_schema, table_name FROM information_schema.tables ORDER BY table_schema, table_name;?