[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: postgresql: copy help



Chris Frost wrote:
  >I'd like to populate a database by entering the info via a text editor in
  >a tab/comma delimited file and import it into PostgreSQL using the copy
  >command, but I can't seem to get it working. I've tried slight variants of
  >"COPY weather FROM test.sql;" where weather is the class, and test.sql is
  >a test file in my current (home) directory that has the data comma
  >delimited.

COPY expects tab-delimited data by default.  If you are using commas,
say this:

  COPY weather FROM 'test.sql' USING DELIMITERS ',';

Note that you must quote the filename and the delimiter charcter.

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "Enter into his gates with thanksgiving, and into his 
      courts with praise. Be thankful unto him, and bless 
      his name."           Psalms 100:4 



Reply to: