2016-06-21 03:06:44 -05:00
|
|
|
.. _schema_dialog:
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2018-06-15 03:14:12 -05:00
|
|
|
**********************
|
|
|
|
`Schema Dialog`:index:
|
|
|
|
**********************
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
Use the *Schema* dialog to define a schema. A schema is the organizational
|
|
|
|
workhorse of a database, similar to directories or namespaces. To create a
|
|
|
|
schema, you must be a database superuser or have the CREATE privilege.
|
2018-01-11 10:58:30 -06:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
The *Schema* dialog organizes the development of schema through the following
|
|
|
|
dialog tabs: *General* and *Security*. The *SQL* tab displays the SQL code
|
|
|
|
generated by dialog selections.
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2016-05-20 15:39:21 -05:00
|
|
|
.. image:: images/schema_general.png
|
2018-01-11 10:58:30 -06:00
|
|
|
:alt: Schema dialog general tab
|
2019-03-08 09:29:05 -06:00
|
|
|
:align: center
|
2016-05-13 08:43:57 -05:00
|
|
|
|
|
|
|
Use the fields on the *General* tab to identify the schema.
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
* Use the *Name* field to add a descriptive name for the schema. The name will
|
|
|
|
be displayed in the *pgAdmin* tree control.
|
|
|
|
* Select the owner of the schema from the drop-down listbox in the *Owner*
|
|
|
|
field.
|
2018-01-11 10:58:30 -06:00
|
|
|
* Store notes about the schema in the *Comment* field.
|
2016-05-13 08:43:57 -05:00
|
|
|
|
|
|
|
Click the *Security* tab to continue.
|
|
|
|
|
2016-05-20 15:39:21 -05:00
|
|
|
.. image:: images/schema_security.png
|
2018-01-11 10:58:30 -06:00
|
|
|
:alt: Schema dialog security tab
|
2019-03-08 09:29:05 -06:00
|
|
|
:align: center
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2018-01-11 10:58:30 -06:00
|
|
|
Use the *Security* tab to assign privileges and security labels for the schema.
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
Click the *Add* icon (+) to assign a set of privileges in the *Privileges*
|
|
|
|
panel:
|
2016-05-13 08:43:57 -05:00
|
|
|
|
|
|
|
* Select the name of the role from the drop-down listbox in the *Grantee* field.
|
2019-03-08 09:29:05 -06:00
|
|
|
* Click inside the *Privileges* field. Check the boxes to the left of one or
|
|
|
|
more privileges to grant the selected privileges to the specified user.
|
2019-11-25 21:03:59 -06:00
|
|
|
* The current user, who is the default grantor for granting the privilege, is displayed in the *Grantor* field.
|
2019-03-08 09:29:05 -06:00
|
|
|
|
|
|
|
Click the *Add* icon (+) to assign additional sets of privileges; to discard a
|
|
|
|
privilege, click the trash icon to the left of the row and confirm deletion in
|
|
|
|
the *Delete Row* popup.
|
|
|
|
|
|
|
|
Click the *Add* icon (+) to assign a security label in the *Security Labels*
|
|
|
|
panel:
|
|
|
|
|
|
|
|
* Specify a security label provider in the *Provider* field. The named provider
|
|
|
|
must be loaded and must consent to the proposed labeling operation.
|
|
|
|
* Specify a a security label in the *Security Label* field. The meaning of a
|
|
|
|
given label is at the discretion of the label provider. PostgreSQL places no
|
|
|
|
restrictions on whether or how a label provider must interpret security
|
|
|
|
labels; it merely provides a mechanism for storing them.
|
|
|
|
|
|
|
|
Click the *Add* icon (+) to assign additional security labels; to discard a
|
|
|
|
security label, click the trash icon to the left of the row and confirm deletion
|
|
|
|
in the *Delete Row* popup.
|
2016-09-02 09:27:10 -05:00
|
|
|
|
|
|
|
Click the *Default Privileges* tab to continue.
|
|
|
|
|
|
|
|
.. image:: images/schema_default_privileges.png
|
2018-01-11 10:58:30 -06:00
|
|
|
:alt: Schema dialog default privileges tab
|
2019-03-08 09:29:05 -06:00
|
|
|
:align: center
|
2016-09-02 09:27:10 -05:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
Use the *Default Privileges* tab to grant privileges for tables, sequences,
|
|
|
|
functions and types. Use the tabs nested inside the *Default Privileges* tab to
|
|
|
|
specify the database object and click the *Add* icon (+) to assign a set of
|
|
|
|
privileges:
|
2016-09-02 09:27:10 -05:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
* Select the name of a role that will be granted privileges in the schema from
|
|
|
|
the drop-down listbox in the *Grantee* field.
|
|
|
|
* Click inside the *Privileges* field. Check the boxes to the left of one or
|
|
|
|
more privileges to grant the selected privileges to the specified user.
|
2019-11-25 21:03:59 -06:00
|
|
|
* The current user, who is the default grantor for granting the privilege, is displayed in the *Grantor* field.
|
2016-05-13 08:43:57 -05:00
|
|
|
|
|
|
|
Click the *SQL* tab to continue.
|
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
Your entries in the *Schema* dialog generate a SQL command (see an example
|
|
|
|
below). Use the *SQL* tab for review; revisit or switch tabs to make any
|
|
|
|
changes to the SQL command.
|
2016-05-24 07:47:35 -05:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
Example
|
|
|
|
*******
|
2016-05-24 07:47:35 -05:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
The following is an example of the sql command generated by selections made in
|
|
|
|
the *Schema* dialog:
|
2016-05-24 07:47:35 -05:00
|
|
|
|
2016-05-20 15:39:21 -05:00
|
|
|
.. image:: images/schema_sql.png
|
2018-01-11 10:58:30 -06:00
|
|
|
:alt: Schema dialog sql tab
|
2019-03-08 09:29:05 -06:00
|
|
|
:align: center
|
2016-05-13 08:43:57 -05:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
The example creates a schema named hr; the command grants *USAGE* privileges to
|
|
|
|
*public* and assigns the ability to grant privileges to *alice*.
|
2018-01-11 10:58:30 -06:00
|
|
|
|
2019-03-08 09:29:05 -06:00
|
|
|
* Click the *Info* button (i) to access online help.
|
2016-05-13 08:43:57 -05:00
|
|
|
* Click the *Save* button to save work.
|
2021-09-26 11:33:11 -05:00
|
|
|
* Click the *Close* button to exit without saving work.
|
2016-05-13 08:43:57 -05:00
|
|
|
* Click the *Reset* button to restore configuration parameters.
|