Utworzyłem tabelę donorw schemacie referencezgodnie z:
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)
);
Wypełniłem tabelę zgodnie z:
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;
Kiedy biegnę:
\dt+ reference.*
wewnątrz psql widzę reference.donortabelę:
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)
Ale kiedy uruchamiam \dt+ donor*(lub \dt(+)) nie widzę reference.donortabeli:
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)
Dlaczego mogę zobaczyć reference.donortabelę tylko po uruchomieniu \dt+ reference.*lub \dt+ *.donor?
Spodziewałem się \dt(lub \dt+) go wyświetlić, ale tak nie jest.
Mój search_pathobejmuje schemat, referencea użytkownik postgresma wszystkie uprawnienia do schematu referencei wszystkich tabel w schemacie zgodnie z:
GRANT ALL ON ALL TABLES IN SCHEMA reference TO postgres;
Aby wyjaśnić, mam dwie donortabele, ale są one w dwóch różnych schematach, tj . oecd.donor& reference.donor. (Widzę oecd.donorbez żadnych problemów, gdy korzystam z \dt(+)psql).
search_pathpierwszej kolejności i bez mojej wcześniejszej znajomości nazw tabel / schematów? A może lepiej zapytaćinformation schemanp .:SELECT table_schema, table_name FROM information_schema.tables ORDER BY table_schema, table_name;?