469,934 Members | 2,132 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

COPY FROM STDIN

I'm struggling using COPY FROM.

COPY ... FROM STDIN

expects stdin to be whatever file is being processed,

so:
$ cat data_file.txt | psql -f load_script.sql MyDB

Does not do what one would expect (and hope).

So we try the psql command:

\copy ... FROM 'data_file.txt'

and get:

psql:load_sricpt.sql:34: ERROR: literal newline found in data
HINT: Use "\n" to represent newline.

which gives a CONTEXT: of the last line of data --- hmmm, is that psql bug?

So we have to resort to:

\c - a_superuser
COPY ... FROM 'full_non_portable_path_to_our_data_file' ....

Which we would much rather avoid.

So,
(a) is there a way to indicate a different input stream for COPY STDIN ?
(b) is \copy broken on NT (cygwin) ?

== Ezra Epstein
Nov 22 '05 #1
0 7535

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Michael Lang | last post: by
2 posts views Thread by wutongjoe | last post: by
reply views Thread by Joshua Ginsberg | last post: by
42 posts views Thread by Andy | last post: by
2 posts views Thread by Josh Close | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.