Tôi đã tạo bảng donortrong lược đồ referencetheo:
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)
);
Tôi đã điền vào bảng theo:
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;
Khi tôi chạy:
\dt+ reference.*
Bên trong psql tôi thấy reference.donorbảng:
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)
Nhưng khi tôi chạy \dt+ donor*(hoặc \dt(+)) tôi không thấy reference.donorbảng:
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)
Tại sao tôi chỉ có thể nhìn thấy reference.donorbảng nếu tôi chạy \dt+ reference.*hoặc \dt+ *.donor?
Tôi đã mong đợi \dt(hoặc \dt+) hiển thị nó, nhưng nó không.
My search_pathbao gồm lược đồ reference& người dùng postgrescó tất cả các quyền trên lược đồ referencevà tất cả các bảng trong lược đồ theo:
GRANT ALL ON ALL TABLES IN SCHEMA reference TO postgres;
Chỉ cần làm rõ, tôi có hai donorbảng, nhưng chúng ở hai lược đồ khác nhau, tức là oecd.donor& reference.donor. (Tôi có thể thấy oecd.donormà không có bất kỳ vấn đề nào khi tôi sử dụng \dt(+)bên trong psql).
search_pathđầu tiên và không có tôi biết trước tên bảng / lược đồ? Hoặc tôi tốt hơn là truy vấninformation schemaví dụ ,:SELECT table_schema, table_name FROM information_schema.tables ORDER BY table_schema, table_name;?