CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2009
    Posts
    398

    Get all tables under a database in Postgre

    I need to get all database names, using SQL script only. I have tried:
    Code:
    SELECT datname FROM pg_database  WHERE datistemplate = false
    and seem to work. I got:
    Code:
    mydb1
    mydb2
    postgres
    mybd1 and mydb2 have been created by me. So far, so good. Now, I need to find all tables under every database, using SQL script only. Is it possible ?

  2. #2
    Join Date
    Jan 2009
    Posts
    398

    Re: Get all tables under a database in Postgre

    It's possible to have tables that is not part of any database in Postgre SQL ?

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,219

    Re: Get all tables under a database in Postgre

    Quote Originally Posted by mesajflaviu View Post
    I need to get all database names, using SQL script only. I have tried:
    Code:
    SELECT datname FROM pg_database  WHERE datistemplate = false
    and seem to work. I got:
    Code:
    mydb1
    mydb2
    postgres
    mybd1 and mydb2 have been created by me. So far, so good. Now, I need to find all tables under every database, using SQL script only. Is it possible ?
    I replied here.
    Victor Nijegorodov

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,219

    Re: Get all tables under a database in Postgre

    Quote Originally Posted by mesajflaviu View Post
    It's possible to have tables that is not part of any database in Postgre SQL ?
    Is it possible to create/have a table not belonging to any database?
    Victor Nijegorodov

  5. #5
    Join Date
    Jan 2009
    Posts
    398

    Re: Get all tables under a database in Postgre

    Yes, make no sense, but I create 2-3 dummy databases, and I don;t know how to select them, but even so, I can create tables, which belongs to no database !!! Why ? Because, if I delete all dummy databases, the new created tables remain ...

    Yes, today I used Postgre, and don't understand how it works ...

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,219

    Re: Get all tables under a database in Postgre

    Sorry, Postgre is like a dark forest for me.
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured