Tuesday, 15 February 2011

List tables in a PostgreSQL schema -


When I do a \ dt in psql, then I get a list of tables in the current schema ( public by default).

How do I get a list of all the tables in all schemas or any particular schema?

In all schemas:

  = & gt; \ Dt *. *   

In a particular schema:

  = & gt; \ Dt public *   

It is possible to use

  \ dt (public | s). (S.T.T) List of Relationship Schema | Name | Type | Owner -------- + ------ + ------- + ------- Public S | Table | CPN Public | T | Table | CPN S | T | Table | CPN   

An advanced user can use regular expression notes such as character classes, for example [0- 9] to match any number, all regular expressions Special characters, 9.0. Which is taken as a separator in the form of the above, which is translated into regular expression. ,? Which is the translation, and $ which is literally matched, can you simulate these pattern characters by writing? For, R for (R + |), for R , or (R |) R?. $ Is not required as the character of regular expression because the pattern should match the whole name, in contrast to the regular interpretation of regular expression (in other words, $ automatically associated with your pattern). Writing * In the beginning and / or at the end if you do not want to anchor the pattern, note that within the double quotation marks, all the regular expression special characters lose their special meaning and match it literally. Also, regular expression special characters are literally matched in operator name patterns (i.e., \\ the argument).

No comments:

Post a Comment