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?

thanks

Answers


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.


Need Your Help

Add a textview for header and footer

android xml layout gridview textview

I've a pretty noob issue with LinearLayouts and GridView.

jquery with check box in asp.net adding click event

asp.net jquery

I have textbox and checkbox in asp.net page.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.