473,396 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 8010

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael Lang | last post by:
Hi to all, can some one point me to the correct way, how to use PostgreSQLs "COPY" feature from within python ? What i want to do is: connect start transaction drop current tablecontens
2
by: wutongjoe | last post by:
Hi all, I was writting 2 programs in c++ using linux.Say,one is app1 and another one is app2,the app1 will generate 100 random numbers and then print them on the standard output,and then the...
0
by: Joshua Ginsberg | last post by:
Howdy -- I have a class that has an attribute that is a dictionary that contains an object that has a kword argument that is a lambda. Confused yet? Simplified example: import copy class...
42
by: Andy | last post by:
and so far I'm loving it, I like the the authors don't beat around the bush and just come straight out and say what the book is sopposed to be. They assume the you have computer experience. I'm...
2
by: Janning Vygen | last post by:
hi PGurus, i searched the archives and read the docs, because this problem shouldn't be new. But i really don't know what to search for. i am populating a database (v7.4.1) with COPY. Some...
4
by: Kevin Murphy | last post by:
This is a tip for the record in case it helps somebody else in the future. I have an import script that relies on a stored procedure that runs as a trigger on inserts into a temporary table. ...
2
by: Josh Close | last post by:
Is there a way to do COPY FROM STDIN from sql? So, remotely I could run the copy command and somehow push the info over instead of having it on the server. -Josh ...
1
by: Shawn Milochik | last post by:
I wrote a script which will convert a tab-delimited file to a fixed-width file, or a fixed-width file into a tab-delimited. It reads a config file which defines the field lengths, and uses it to...
1
by: denniswimer | last post by:
I seem to be having issues with the <psql -U postgres -d database1> -c "COPY <tablename> TO STDOUT;" | <psql -U postgres -d database2> -e -c "COPY <tablename> FROM STDIN;" when both databases reside...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.