On 13 Nov 2010, at 3:44, ray wrote:
> On Nov 10, 11:07 pm, robjsarg(dot)(dot)(dot)(at)gmail(dot)com (Rob Sargent) wrote:
>> ray wrote:
>>> I also tried the shell. create mydb. I used all the defaults but the
>>> console came back and rejected all the defaults and closed the
>>> I would like to export an Excel file as CVS and ;'copy' into pg. So I
>>> would like to learn how to create a new database and what ever goes
>>> along with that to acheive this goal.
>>> I would appreciate all help.
>> if the defaults are in play the owning account should be able to do
>> createdb somedbname;
>> You left of the "db" in createdb in your posting.
> I really didn't understand. I was trying to create a new db inside of
> the pg shell. I found that I needed to do it at the OS command
> prompt. This was totally unclear in the manual.
That's not true, it's just that the command you used wouldn't have worked in either.
On the OS shell's command line (cmd in Windows) you use "createdb mydb" to create a database,
in the psql shell you use "CREATE DATABASE mydb;".
I expect the latter command would work in pgadmin too (although you may have to leave out the semi-colon), but it probably has a convenient menu option for creating databases somewhere.
I tend to install MSys in Windows so that I have a proper UNIX shell to run those commands from, but it's a bit hard to set up.
> Now I have found that the copy cammand is to be done in the shell.
If you're saying shell, do you mean your OS shell (cmd.exe) or are you talking about the psql shell?
To copy data you can use either the \copy command built in the psql shell, or you can use the COPY statement directly and copy from STDIN, followed by your CSV data and closed with a \. terminator.
Check the documentation on COPY for details and examples.
> Now if I could just find out if it is working. I can't seem to look into the db.
I guess you're talking about pgadmin here, with which I'm not familiar. It's probably just not connected to your database, guessing from your earlier remark about the red X.
Is the database server on the same machine as pgadmin? If not, you probably need to edit pg_hba.conf to allow access from the machine running pgadmin.
In the psql shell you can type \dt to see your tables (or \? for a list of built-in commands) and use SELECT statements to look at your data.
You could also try to hook up an ODBC connection to your database and look at it using Access or Openoffice's variant of that. There are plenty more possibilities.
Screwing up is an excellent way to attach something to the ceiling.
In response to
pgsql-general by date
|Next:||From: Merlin Moncure||Date: 2010-11-13 15:58:11|
|Subject: Re: Insert data with greek characters using psql environment|
|Previous:||From: Tom Lane||Date: 2010-11-13 03:49:35|
|Subject: Re: More then 1600 columns? |