WebFaction
Community site: login faq

I'm trying to load data into a table called points using the following SQL syntax:

COPY points (id, address)
    FROM '$HOME/data/testdataReduced.csv'
    WITH 
          DELIMITER AS ','
          CSV HEADER ;

The error message that I received is the following:

ERROR: must be superuser to COPY to or from a file

Is there any way that I can load data in using this approach? I want to have a php file that would run SQL to load in data as a batch process ever 24 hours so I would prefer not to use psql.

asked 27 Aug '12, 05:35

womble
15148
accept rate: 0%


You can't use COPY, for the reason stated in the error message.

Instead, have your PHP script step through your CSV file, doing an INSERT for each row of data.

Hope that helps!

permanent link

answered 27 Aug '12, 12:47

seanf
12.2k41836
accept rate: 37%

edited 27 Aug '12, 12:47

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×262
×108
×9

question asked: 27 Aug '12, 05:35

question was seen: 4,291 times

last updated: 27 Aug '12, 12:47

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM