Step by step and thorough pgadmin/postgresql documentation

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

Step by step and thorough pgadmin/postgresql documentation

От:
Gerhard Botha <gbotha@winder.co.za>
Дата:
Вложения:
I downloaded postgresql and pgadmin and am setting up an experimental 
database in our company.

I have a basic grasp on relational databases but now need a bullet proof 
tutorial on setting up users and privileges as well as dealing with 
autoincremental primary keys.

We have a Linux server with postgresql and I have set my PC up as a 
windows client using both pgadmin iii and openoffice.

I can connect, create databases, create users with different privileges etc.

I consider myself a newbie.

I would like access to a full example of setting up a small database 
with users having different rights and tables with  the full cycle of 
not just creating things but actually putting values in and doing so 
using pgadmin's dialogues and not just SQL statements if possible.

The available documentation I can find only shows things in isolation 
but I have found many problems trying to actually do something useful.

For instance.
I create a db with one superuser as the owner and one user with only 
select/update/insert/delete access.
I create a new schema with one table that has two columns. one column is 
the primary key with serial data. the other is a text field.

On my installation, the regular user is denied access to this table.
I then log on as the super user and go to the table and click on the 
privileges tab. Here, I find no sign of the users I have created. Only 
"public". If I assign all rights to public, I can now connect as the 
regular user and open the table using the "view data" option when 
left-clicking the table. That gives me a window with the table's cells 
displayed. Now this does not seem right, it is not described like this 
in the documentation as far as I can see.

In the newly opened window, the key column is empty and the text column 
also. I ought to be able to just edit information into the text field 
and expect the db to auto add a number to the key field, but it does 
not. It responds with some story about the user not having access to the 
sequence function. I now go to that and grant public access to that. But 
now I can not get the table to generate a primary key automatically. I 
can only enter a value there myself. Despite the fact that the primary 
key field is correctly defined etc according to the manual.

So I need a tutorial because right now I do not know if the installation 
suffers from some weird problem or if I simply do not understand 
postgresql and pgadmin.

Oh, and by the way, I also installed pgadmin on my machine as a local 
host and experience exactly the same so I doubt that it is the installation.

To say the least, to a newbie, this is messy as hell. I have no problems 
understanding the isolated bits in the manual but I find the whole a bit 
nebulous when you try to actually do a real system.

Any help will be greatly appreciated.

-- 
Gerhard Botha
Marketing Director
Winder Controls (Pty) LTD
+11 873 4650
+83 700 1023
www.winder.co.za

Re: Step by step and thorough pgadmin/postgresql documentation

От:
Marcin Stępnicki <mstepnicki@gmail.com>
Дата:
On Thu, Mar 5, 2009 at 7:59 AM, Gerhard Botha  wrote:
> On my installation, the regular user is denied access to this table.

I think you've missed that you also need to grant USAGE privilege for
the schema. http://www.postgresql.org/docs/8.3/interactive/sql-grant.html

> I then log on as the super user and go to the table and click on the
> privileges tab. Here, I find no sign of the users I have created. Only
> "public".

Go to File/Options/Preferences and turn on "Show users for
privileges". This should be default in my opinion.

> So I need a tutorial because right now I do not know if the installation
> suffers from some weird problem or if I simply do not understand postgresql
> and pgadmin.

The latter, I suppose :-). However, I understand your problem. I am
not aware of such tutorial, but if you need some sample databases you
may take a look at http://pgfoundry.org/frs/?group_id=1000150 . That
should be helpful.

Regards,
Marcin

Re: Step by step and thorough pgadmin/postgresql documentation

От:
Dave Page <dpage@pgadmin.org>
Дата:
On Thu, Mar 5, 2009 at 9:05 AM, Marcin Stępnicki  wrote:

> Go to File/Options/Preferences and turn on "Show users for
> privileges". This should be default in my opinion.

No it shouldn't. In most cases if you're configuring permissions for
individual users then you're setting yourself up for future pain and
suffering.

Setup your permissions for group roles, and then add user roles to
those groups. Then if you have staff turnover, or decide you want to
use different user accounts for each of your webservers that access
the database or whatever, instead of having to recreate a complex set
of permissions for each new user, you simply add them to the
appropriate groups.


-- 
Dave Page
EnterpriseDB UK:   http://www.enterprisedb.com

Re: Step by step and thorough pgadmin/postgresql documentation

От:
Marcin Stępnicki <mstepnicki@gmail.com>
Дата:
2009/3/5 Dave Page :
> On Thu, Mar 5, 2009 at 9:05 AM, Marcin Stępnicki  wrote:
>
>> Go to File/Options/Preferences and turn on "Show users for
>> privileges". This should be default in my opinion.
>
> No it shouldn't. In most cases if you're configuring permissions for
> individual users then you're setting yourself up for future pain and
> suffering.

Well, I have it turned off anyway :-). You are certainly right, but
Gerhard's question reminded me that at least two of my work colleagues
were searching for that option. But perhaps it's better to encourage
proper habits from the beginning, so I see your point.

Regards,
Marcin

Re: Step by step and thorough pgadmin/postgresql documentation

От:
Gerhard Botha <gbotha@winder.co.za>
Дата:
Вложения:
Thank you for the information guys. I did manage to figure it out 
eventually. And yes, I would prefer using groups in the real world. I 
missed the preferences thing completely though.

Regards, Gerhard
FAQ