#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    1
    Rep Power
    0

    Export database/table structure to CSV


    EDIT: Found solution

    Code:
    COPY (select * from information_schema.columns) TO 'E:\z_temp\psql_csvs\columns.csv' with delimiter ',' csv header;
    Hello all. First post here, and rookie Postgres user.

    I would like to be able to export from PSQL a CSV, or other type of ASCII file, of each of the databases structure (schemas, tables, and table columns. Can this be done?

    In PGAdminIII, ultimately I would like to get a copy of...

    Catalogs > ANSI (information_schema) > columns into Excel

    Thanks in advanced for any help you can provide.
    Last edited by flippingeo; January 6th, 2014 at 10:10 AM. Reason: Found solution
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    158
    Rep Power
    10
    [QUOTE=flippingeo]EDIT: Found solution

    Code:
    COPY (select * from information_schema.columns) TO 'E:\z_temp\psql_csvs\columns.csv' with delimiter ',' csv header;
    What are you trying to create exactly? If you are looking for a document that explains your database structure you should probably look at dbSchema, which will also allow you to generate an HTML diagram with textdocuments that explain the entire database, element by element.

IMN logo majestic logo threadwatch logo seochat tools logo