Reputation:
Trying to save a text file from desktop
copy my_notes(notes) from '/root/desktop/test_note.txt'
It shows this error..
ERROR: extra data after last expected column
CONTEXT: COPY my_notes, line 3: " cher"
I'm a newbie in postgresql
Upvotes: 0
Views: 159
Reputation: 658102
To read a plain text from a file, there is also pg_read_file()
- reserved for superusers, though, because of potential security implications. Details in this related answer:
Read data from a text file inside a trigger
Upvotes: 0
Reputation: 324771
COPY
expects tab-separated data, with newlines separating rows.
It isn't suitable for just loading a text file into a field. To do that, I suggest using a simple script, say python
and psycopg2
.
Upvotes: 2