From:       To:      

Import PostgreSQL Script Files

[SQL Server to PostgreSQL]  [MySQL to PostgreSQL]  [Oracle to PostgreSQL

This article explains how to move dump file contents to PostgreSQL server using the most popular tools.

PostgreSQL console client (psql)

Syntax of the command line depends on the structure of the dump file. If the dump file contains 'CREATE DATABASE' statement you should call the tool as follows:

psql -h hostname -U username -f {SQL script file name}

Otherwise:

psql -h hostname -d databasename -U username -f {SQL script file name}

Of course you need to replace parameters in figure brackets {...} by actual values.

phpPgAdmin

To import SQL script file into PostgreSQL database using this tool, take the following steps:

  1. Select the database
    Select the database
  2. Navigate to the "SQL" button
    Navigate to the SQL
  3. Click the "Choose File" (or "Browse") button and select the SQL file from your computer
    Click the Choose File
  4. Click "Execute" button

Have questions? Contact us