PgAccess - Tutorial

User Administration

The procedure for setting up postgreSQL usually results in a single user named postgres. In order for anyone else to use postgreSQL, users must be added. The program createuser accomplishes this. First become the PostgreSQL administrator (usually postgres):

su postgres

Then create a new user:

createuser jim
Enter user's postgres ID or RETURN to use unix user ID: 500 ->
Is user "jim" allowed to create databases (y/n) y
Is user "jim" a superuser? (y/n) n
createuser: jim was successfully added

You can use either the UNIX user ID or the postgres ID to identify users. See the postgreSQL documentation in the "admin" section for a fuller account of users and groups.

To remove users, use the destroyuser command in the same way.

Basic use of PgAccess

Creating a database

At the right is the window you should see when PgAccess starts up. The first task for most users will be to create a database.

Press the New button to bring up the window shown below. This will allow you to specify the structure of the new table. It is important to note that if you haven't specified a database when starting up PgAccess, this table will be created in the database named <username>, your username.

Assume that you want to create a table with entries describing bibliographic references in the field of chemistry. Choose a table name, such as chemref that will be easy to recall and find in a list. Enter the table name in the first input field.

When you already have tables in a database, you can use the Inherits button to toggle a list of existing tables to inherit characteristics of another table. In this example, there should be no previous tables to use.

Enter each field, giving it a name, field type and size, if the field type does not imply the size. That is, if your first field was to be a sequence number, and you selected int2 as the field type, you would not have to specify a field size. However, if your second field was to contain the author of the reference, and was a varchar type, you would have to specify how many characters would be allowed in the field.

As you enter each field, click the Add field button to add it to the list at the right side of the window. You can change the position of fields using the Move field up and Move field down buttons, or delete a field if you decide it isn't what you wanted. When you are finished specifying fields, press the Create table button.

Back to index