जवाबों:
आपको select * from information_schema.tables
किसी विशेष डेटाबेस के लिए Postgres द्वारा प्रबंधित की जा रही प्रत्येक तालिका की सूची प्राप्त करने के लिए बस चलाने में सक्षम होना चाहिए ।
आप where table_schema = 'information_schema'
सूचना स्कीमा में सिर्फ सारणी देखने के लिए एक जोड़ सकते हैं ।
अपनी तालिकाओं के उपयोग की सूची के लिए:
SELECT table_name FROM information_schema.tables WHERE table_schema='public'
यह केवल आपके द्वारा बनाई गई तालिकाओं को सूचीबद्ध करेगा।
\dt information_schema.
psql के भीतर से, ठीक होना चाहिए।
"\ Z" COMMAND भी सूची टेबल जब इंटरैक्टिव psql सत्र के अंदर करने के लिए एक अच्छा तरीका है।
जैसे।
# psql -d mcdb -U admin -p 5555
mcdb=# /z
Access privileges for database "mcdb"
Schema | Name | Type | Access privileges
--------+--------------------------------+----------+---------------------------------------
public | activities | table |
public | activities_id_seq | sequence |
public | activities_users_mapping | table |
[..]
public | v_schedules_2 | view | {admin=arwdxt/admin,viewuser=r/admin}
public | v_systems | view |
public | vapp_backups | table |
public | vm_client | table |
public | vm_datastore | table |
public | vmentity_hle_map | table |
(148 rows)
'xxx'
Postgresql में निजी स्कीमा के लिए :
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'xxx' AND table_type = 'BASE TABLE'
बिना table_type = 'BASE TABLE'
, आप तालिकाओं और विचारों को सूचीबद्ध करेंगे
सूचना के आधार पर तालिकाओं और विचारों को भूल जाएं। सूचनाओं को शामिल करें।
select * from information_schema.tables
5. भूलना और विचार कुछ स्कीमा के होते हैं
select * from information_schema.tables
where table_schema not in ('information_schema', 'pg_catalog')
केवल (लगभग \ dt) भूल जाओ
select * from information_schema.tables
where table_schema not in ('information_schema', 'pg_catalog') and
table_type = 'BASE TABLE'
where table_schema not in ('information_schema', 'pg_catalog')
में इसके लिए क्या है ?
यदि आप एक त्वरित और गंदा वन-लाइनर क्वेरी चाहते हैं:
select * from information_schema.tables
आप इसे psql को खोले बिना सीधे क्वेरी टूल में चला सकते हैं।
(अन्य पोस्ट में अच्छी और अधिक विशिष्ट सूचनाओं के बारे में जानकारी दी गई है। लेकिन एक नए रूप में, मुझे यह पता चल रहा है कि यह एक-लाइनर क्वेरी मुझे तालिका के साथ पकड़ पाने में मदद करती है)