473,732 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_sricp t.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_porta ble_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 8042

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

Similar topics

3
2944
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
1414
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 app2 needs to copy the numbers from the standard output to its int array by doing this way: $ app1|app2 (a pipe ? I am a newbi,and not sure how to call that ).the app1 is finished and numbers seem ok,the problem is ,how does app2 copy from screen?...
0
1700
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 Foo: def __init__(self, fn=None):
42
2529
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 loving the exercises they really leave you with a sense of freedom to do what you want, just follow the rules. Just a little rant, I would definitely recommend this book to anyone interested in C. Great addition to anyones library.
2
2670
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 triggers in the db schema fire on inserts and do some additional data manipulations, which i dont want to take place by running COPY because my data don't need those additional manipulation. Therefor and for performance reasons, i disable all...
4
17958
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. The script looks like this: -- create table -- ... -- define procedure and trigger
2
3564
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 ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org
1
2070
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 convert either way. Here's an example of the config file: 1:6,7:1,8:9,17:15,32:10 This converts a fixed-width file to a tab-delimited where the first
1
7775
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 on the same localhost machine. These commands work beautifully when the databases reside on different remote machines. I could find nothing in documentation or forums that would indicate that this is an issue. The only difference in execution is...
0
8773
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9445
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9306
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6733
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3259
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.