Access privileges

Four privileges govern how users can access a table. As the owner of the table, you can grant or withhold the following privileges independently:
  • Select allows selection, including selecting into temporary tables.
  • Insert allows a user to add new rows.
  • Update allows a user to modify existing rows.
  • Delete allows a user to delete rows.

The Select privilege is necessary for a user to retrieve the contents of a table. However, the Select privilege is not a precondition for the other privileges. A user can have Insert or Update privileges without having the Select privilege.

For example, your application might have a usage table. Every time a certain program is started, it inserts a row into the usage table to document that it was used. Before the program terminates, it updates that row to show how long it ran and perhaps to record counts of work its user performs.

If you want any user of the program to be able to insert and update rows in this usage table, grant Insert and Update privileges on it to PUBLIC. However, you might grant the Select privilege to only a few users.