473,385 Members | 1,492 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,385 software developers and data experts.

Problems with \copy and delimiters ','

I'm having some problems using \copy

I have a directory full of test data that I want to be installed automatically
when "make database" is issued. While the Makefile rules would seem simple, I'm
having some trouble.

I want to do this
\copy table_name from 'table_name.cdf' delimiters ',';

But I get:
\copy: parse error at "delimiters"

A similar command:
copy table_name from '/path/to/file/table_name.cdf' delimiters ',';
works fine, but this makes things complicated, as I don't know the path to the
files until it happens (who knows where the tarball will be unpacked, I want to
give a relative path, not an absolute).

The documentation I've found on \copy says to see the docs on copy ;)

Does the \copy command not support "delimiters"? This is 7.4 on FreeBSD 5.1.

--
Bill Moran
Potential Technologies
http://www.potentialtech.com
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 22 '05 #1
2 9750
Bill Moran <wm****@potentialtech.com> writes:
I want to do this
\copy table_name from 'table_name.cdf' delimiters ','; But I get:
\copy: parse error at "delimiters"
Looking at the psql code, it evidently wants "with delimiter" ...

regression=# \copy table_name from 'table_name.cdf' with delimiter ','
table_name.cdf: No such file or directory
The documentation I've found on \copy says to see the docs on copy ;)


It's *supposed* to match the backend syntax, but seems a few bricks
shy of a load at the moment. Anyone feel like fixing it? See
parse_slash_copy() in src/bin/psql/copy.c.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 22 '05 #2
Tom Lane wrote:
Bill Moran <wm****@potentialtech.com> writes:
I want to do this
\copy table_name from 'table_name.cdf' delimiters ',';

But I get:
\copy: parse error at "delimiters"


Looking at the psql code, it evidently wants "with delimiter" ...

regression=# \copy table_name from 'table_name.cdf' with delimiter ','
table_name.cdf: No such file or directory


Yes, that does indeed work. Note "with delimiter" not "with delimiters"
The documentation I've found on \copy says to see the docs on copy ;)


It's *supposed* to match the backend syntax, but seems a few bricks
shy of a load at the moment. Anyone feel like fixing it? See
parse_slash_copy() in src/bin/psql/copy.c.


Oops ... I'll try to look at this code this weekend, but (to be honest)
I doubt I'll have much time to do anything to it. Unless the fix it
very simple, I probably won't get anything done.

BTW Tom: I see your mailserver rejects mail from Adelphia. I can't say
that I blame you, but it prevents me from emailing you directly until I
get smtp auth set up on mail.potentialtech.com (which, based on my
schedule, is not a priority right now ...) But I did have something
Pittsburgh-related that I wanted to ask you about ... could you give
me a phone call, possibly? (# is on the web site) or pass on another
way that I could reach you?

--
Bill Moran
Potential Technologies
http://www.potentialtech.com
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 22 '05 #3

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

Similar topics

5
by: me | last post by:
I'm also having problems getting the bulk insert to work. I don't know anything about it except what I've gleened from BOL but I'm not seeming to get anywhere...Hopefully there is some little (or...
9
by: Mark | last post by:
Hi there On this page i get some errors when validating: http://www.keyone.nl/lab/beeldlijn/nl/collection.asp The problem is caused by the use of ASP in my pages. This is the code: <a...
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: Jon Asher | last post by:
Hi, I'm trying to do a simple import of a comma delimited text file with COPY but it's returning an error. The file has been granted all permissions in Linux, so it's not clear to me what the...
1
by: Rachel McConnell | last post by:
Hi, I am trying to import data using COPY, from a file containing thirty or so COPY commands each with 0 or more rows of data. Reason, I have a small data set I want to include into a database...
9
by: electrixnow | last post by:
Can anyone tell me who sizeof &tokens only return a int of 4 no matter how many strings that are in the token. thanks, Grant #include <cstring>
1
by: electrixnow | last post by:
Help!, I need to compile this code with static libs so it run on another XP machine that does'nt have MS Studio installed. When I compile now I get an ERROR: 1>------ Rebuild All started:...
6
m6s
by: m6s | last post by:
1. After hours of researching, I used these snippets : void Object::TokenizeLines(const string& str, vector<string>& tokens, const string& delimiters) // Skip delimiters at beginning....
1
by: zeny | last post by:
Hey folks! Can anyone tell me how to add data to a table using "copy" with several delimiters? Is it possible? What i mean is: Copy <table_name> from <file_directory> using delimiters...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.