Ich habe die Tabelle donorim Schema referencewie folgt erstellt:
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)
);
Ich habe die Tabelle wie folgt ausgefüllt:
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;
Wenn ich renne:
\dt+ reference.*
In PSQL sehe ich die reference.donorTabelle:
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)
Aber wenn ich renne \dt+ donor*(oder \dt(+)) sehe ich die reference.donorTabelle nicht:
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)
Warum kann ich die reference.donorTabelle nur sehen, wenn ich renne \dt+ reference.*oder \dt+ *.donor?
Ich habe erwartet \dt(oder \dt+), dass es angezeigt wird, aber das tut es nicht.
Meine search_pathenthält das Schema referenceund der Benutzer postgreshat alle Berechtigungen für das Schema referenceund alle Tabellen im Schema wie folgt:
GRANT ALL ON ALL TABLES IN SCHEMA reference TO postgres;
Zur Verdeutlichung habe ich zwei donorTabellen, aber sie befinden sich in zwei verschiedenen Schemata, dh oecd.donor& reference.donor. (Ich kann oecd.donorohne Probleme sehen, wenn ich \dt(+)in psql verwende).
search_pathersten platziert ist und ohne dass ich die Tabellen- / Schemanamen im Voraus kenne ? Oder bin ich besser abzufragen dieinformation schemazB ,:SELECT table_schema, table_name FROM information_schema.tables ORDER BY table_schema, table_name;?