I have a file that I'm trying to import into psql from within my php script:
// php snippet
$sql2 = "COPY ".$table." FROM '".basename( $_FILES['uploadedfile']['tmp_name'])."' USING delimiters '|'";
$result2 = $database->query($sql2);
This generates this error:
PHP Warning: pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: must be superuser to COPY to or from a file\nHINT: Anyone can COPY to stdout or from stdin. psql's \copy command also works for anyone.
Is there a way around this? How can I import the file without getting this error and without having to login as superuser? I saw something about pg_put_line, but have no idea how to use that to import from a file. Tried looking at various samples, but it all felt a bit above me. This is my first time using psql, so help is appreciated.