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
Bill Moran <wmoran@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
Tom Lane wrote:
Bill Moran <wmoran@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