0

1) I tried to import csv file by right clicking on 'column' name, then select import and my csv file, but when I query I cant see anything.

2) Then I tried second way to import csv as in the pic by copying. it gives an error saying the table doesnt exist.

Okay I changed the database, but it still doesnt work

enter image description here

  • Does this answer your question? [How to import CSV file data into a PostgreSQL table?](https://stackoverflow.com/questions/2987433/how-to-import-csv-file-data-into-a-postgresql-table) – Nitin Bisht Apr 02 '20 at 19:52
  • thanks but, no. i searched a lot over internet, i couldnt get it done. I just would like to know where i did my mistake. –  Apr 02 '20 at 19:54
  • it shouldnt be too hard to get it work, in the page you shared is too long explanations. if it was that hard for postgres, i would use mysql or another –  Apr 02 '20 at 19:56
  • Most people here cannot understand the error message. You could get more help if you translate it to english. (and dont post as a picture. Post as text, please) – wildplasser Apr 02 '20 at 19:58
  • Thank you for your comment. It says "Error 42P01: relation does not exist ". my region table doesnt exist, but you see its exist on the left –  Apr 02 '20 at 19:59
  • What is the database and schema of the `region` table? It is not visible on the screenshot. – Abelisto Apr 02 '20 at 20:00
  • @Abelisto i just gave a name to database as 'cityregion' by myself, i dont know if i need to make a relation. And i didnt do anything with schema part. Its my first time trying to import csv file on postgres, please help –  Apr 02 '20 at 20:02
  • Check https://dba.stackexchange.com/questions/101570/error-42p01-relation-does-not-exist – Nitin Bisht Apr 02 '20 at 20:05
  • 1
    You are connected to the `postgres` database as shown on the query tool header. If the `region` table is in the `cityregion`database then surely it is not found in your current session. – Abelisto Apr 02 '20 at 20:05
  • @Abelisto yeah there was one database named "postgres", then i made a new one for this csv files named cityregion. So how should i change it? –  Apr 02 '20 at 20:07
  • I don't use pgadmin since 4 version so I just don't know. Sorry. Investigate it by yourself. – Abelisto Apr 02 '20 at 20:09
  • thank you anyway @Abelisto ill try to find –  Apr 02 '20 at 20:10
  • @NitinBisht i looked at it before, and it didnt make me solve it, but thanks for your effort –  Apr 02 '20 at 20:13
  • 1
    PS: After fixing this issue you are probably will faced with another one that will say something like "file is not available". It is because the file to load should be available to the PostgreSQL server itself. I strongly recommend to start to learn `psql` command line utility - it makes many things much easier. – Abelisto Apr 02 '20 at 20:21
  • @Abelisto thank you for your answers, ill try learning it –  Apr 02 '20 at 20:23
  • 1
    Do not worry - it redirects to this link: https://www.postgresqltutorial.com/import-csv-file-into-posgresql-table/ – Abelisto Apr 02 '20 at 20:24
  • oh thank you , i was afraid cause it didnt open in my browser, and when i see a link inside a link, it made me worried. –  Apr 02 '20 at 20:25

0 Answers0