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

    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0

    Relation "tablename" does not exist


    I have created a table in Excel, saved it as .csv (comma delimited), and have moved that file over to my Ubuntu server that I am using to run PostgreSQL. I have tried running:

    COPY "example" FROM '/home/username/example.csv' WITH DELIMITER ',';

    and I always receive an error message saying:

    ERROR: relation "example" does not exist

    I read that it may be due to the permissions on the .csv file since it was not created by this user account (or even on this computer), and I have changed the permissions to read and write for all users. It still gives the error, so maybe I misunderstood the suggestion I read or maybe I am having a different problem. Any guidance would be appreciated.
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,921
    Rep Power
    1045
    Hi,

    I could hardly think of a clearer error message.

    PostgreSQL is telling you that the table (aka relation) example you're trying to copy your data to doesn't exist. In other words, you need to create it before you can fill it with data.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo