Thread: How does one get names of all tables in a DB
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">I have looked through all of the documentation could find and still can not find out how to get namesof all tables in a specified DB.</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Is there a way through libpq c interface or through a SQL message sent through pqexec to get a list ofall of the tables in a given DB?</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Bruce</span></font></div>
On Wed, Mar 16, 2005 at 05:41:39PM -0500, Clay, Bruce wrote: > I have looked through all of the documentation could find and still can > not find out how to get names of all tables in a specified DB. See the "System Catalogs" chapter. Here's a link to the latest version: http://www.postgresql.org/docs/8.0/interactive/catalogs.html -- Michael Fuhr http://www.fuhr.org/~mfuhr/
At 05:41 PM 3/16/05, Clay, Bruce wrote:<br /><blockquote cite="cite" class="cite" type="cite"><font face="arial" size="2">Ihave looked through all of the documentation could find and still can not find out how to get names of all tablesin a specified DB.<br /></font><br /><font face="arial" size="2">Is there a way through libpq c interface or througha SQL message sent through pqexec to get a list of all of the tables in a given DB?</font></blockquote><br /><br />Do you have access to CLI? Run psql with the -E option to show you the SQL behind any of its commands. Issue the \dtcommand to list tables. Process the SQL through your favourite interface.