Rails App- postgresql - learning to use copy command - location of db on mac OSX?
Hi Im learning how to use postgresql's COPY command to import data in from a csv file on my local drive onto the postgresql db of my rails app.
The first step is how do I find the location of postgresql on my local drive?
Wouldn't I need it to call the COPY command?
I have pg3admin which I can see as a gui, it has all my databases. but where would I be calling the copy command from?
To COPY into a table FROM a file, the file must be accessible to the OS user running the PostgreSQL server, or (more commonly) to the OS user running your client. In the latter case, you COPY tablename FROM STDIN, and your client application feeds the file to the server. To do this in psql you use \copy.
Most of postgres lives (assuming you're using a *nix OS) in /var/lib/pgsql. The postgres manual has more info about where files are commonly found, and what each file does.