Обсуждение: PG commands not working?

Поиск
Список
Период
Сортировка

PG commands not working?

От
"Just E. Mail"
Дата:
This question seems so simple but I don't have an answer.

Installed CentOS 5.3, Postgresql 8.3.7 (Libs, Server, Devel) & pgAdmin.

Then created a user/role as follows:
---------------------
% su - postgres
-bash-3.2$creatuser radius --no-superuser --no-createdb --no-createrole -P
Enter password for new role: radius
Enter it again: radius
-bash-3.2$exit
---------------------

Then I checked in pgAdmin & radius is listed under 'login roles'.

Now I tried to create a SCHEMA:

% su - postgres
-bash-3.2$CREATE SCHEMA radius AUTHENCATION radius
Error: create: command not found.

Then tried ';' at the end:

-bash-3.2$CREATE SCHEMA radius AUTHENCATION radius;
Error: create: command not found.

Then I tried the same command as root:

%CREATE SCHEMA radius AUTHENCATION radius
Error: create: command not found.

PostgreSQL manual at page 1029 lists the above command to create a SCHEMA!

------------------------------
What am I doing wrong?

Re: PG commands not working?

От
Alan Hodgson
Дата:
On Tuesday 26 May 2009, "Just E. Mail" <justemail@imwell-usa.com> wrote:
> What am I doing wrong?

You're running psql commands at a bash prompt. Try running createdb with
appropriate arguments and then the psql command to connect to it. Then you
can use your psql commands in the psql client.


--
I contend that for a nation to try to tax itself into prosperity is like a
man standing in a bucket and trying to lift himself up by the handle.
 -- Winston Churchill

Re: PG commands not working?

От
"Just E. Mail"
Дата:
Alan Hodgson wrote:
> On Tuesday 26 May 2009, "Just E. Mail" <justemail@imwell-usa.com> wrote:
>
>> What am I doing wrong?
>>
>
> You're running psql commands at a bash prompt. Try running createdb with
> appropriate arguments and then the psql command to connect to it. Then you
> can use your psql commands in the psql client.
>
>
>
Did I mention I am a NOVICE! I have idea what you wrote. Please be kind
and give some more hint!

Re: PG commands not working?

От
Alan McKay
Дата:
> Did I mention I am a NOVICE! I have idea what you wrote. Please be kind and
> give some more hint!

You need to run the psql command first, then all the commands you tried.

Check the man page for options to specify username, host and so forth.

I'm a new convert from mysql otherwise I'd rhyme them off for you.  As
it stands I'm still checking the man pages myself :)


--
“Mother Nature doesn’t do bailouts.”
         - Glenn Prickett

Re: PG commands not working?

От
Jasen Betts
Дата:
On 2009-05-26, Just E. Mail <justemail@imwell-usa.com> wrote:
> This question seems so simple but I don't have an answer.
>
> Installed CentOS 5.3, Postgresql 8.3.7 (Libs, Server, Devel) & pgAdmin.
>
> Then created a user/role as follows:
> ---------------------
> % su - postgres
> -bash-3.2$creatuser radius --no-superuser --no-createdb --no-createrole -P
> Enter password for new role: radius
> Enter it again: radius
> -bash-3.2$exit
> ---------------------
>
> Then I checked in pgAdmin & radius is listed under 'login roles'.

that bit worked.

> Now I tried to create a SCHEMA:
>
> % su - postgres
>
> -bash-3.2$CREATE SCHEMA radius AUTHENCATION radius
> Error: create: command not found.

here you need to do psql to get the postgres command-line
the prompt will look like this

postgres=#

before creating a schema you probably want to create (or if it already
exists connect to) a different database,

postgres=# create database radius owner radius;
CREATE DATABASE
postgres=# \c radius
radius=# CREATE SCHEMA radius AUTHENCATION radius;
CREATE SCHEMA