Book Image

PostgreSQL 9 Administration Cookbook - Second Edition

Book Image

PostgreSQL 9 Administration Cookbook - Second Edition

Overview of this book

Table of Contents (19 chapters)
PostgreSQL 9 Administration Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Setting parameters for particular groups of users


PostgreSQL supports a variety of ways of defining parameter settings for various user groups. This is very convenient, especially to manage user groups that have different requirements.

How to do it…

For all users in the saas database, use the following commands:

ALTER DATABASE saas SET configuration_parameter = value1;

For a user named simon connected to any database, use this:

ALTER ROLE Simon SET configuration_parameter = value2;

Alternatively, you can set a parameter for a user only when connected to a specific database, as follows:

ALTER ROLE Simon IN DATABASE saas SET configuration_parameter = value3;

The user won't know that these have been executed specifically for them. These are default settings, and in most cases, they can be overridden if the user requires nondefault values.

How it works…

You can set parameters for each of the following:

  • Database

  • User (which is named role by PostgreSQL)

  • Database/user combination

Each of the parameter...