Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Correct syntax for using \copy to import a file into a Postgres db

by bichonfrise74 (Vicar)
on Nov 12, 2009 at 05:02 UTC ( [id://806644]=note: print w/replies, xml ) Need Help??


in reply to Correct syntax for using \copy to import a file into a Postgres db

I'm not familiar with the syntax of Postgresql, but I think you just need to do something like this.
my $s2 = "\\copy (" ....
Or what you can do is to print $s2 and see if the syntax is valid in Postgresql.
  • Comment on Re: Correct syntax for using \copy to import a file into a Postgres db
  • Download Code

Replies are listed 'Best First'.
Re^2: Correct syntax for using \copy to import a file into a Postgres db
by BruceDB (Novice) on Nov 12, 2009 at 06:20 UTC

    thx,

    i tried \\c but that also wasn't working.

    your second idea was a good one. i printed $s2 and entered it directly into psql.

    that, however, revealed another issue:

    btest-> \copy (testingtable) FROM 'data.tsv' data.tsv: No such file or directory

    now i have to figure out what directory i'm in and what directory the file is in. according to some documentation, i should be able to get the first by entering in \!pwd, however, psql is telling me that is an invalid command.

      Hi did u fixed the error? If yes please suggest me with some hint. I'm facing the same error even when giving the correct file path

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://806644]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-19 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found