commit 508dc751e2ed60e9ba6bb4849e9320543ae0f134 Author: David G. Johnston Date: Tue Jul 14 15:38:30 2020 +0000 Link CREATE/DROP TYPE and DOMAIN to the Glossary We have a generic term that encompasses tables, views, etc..., "relation". Introduce the term "type definition" to encompass base, composite, domain, etc... types. The individual types are the rows on pg_type while type definition represents the allowed values for the pg_type.typtype column (restricted to user-creatable ones). Update the TYPE and DOMAIN pages to refer to these glossary entries. diff --git a/doc/src/sgml/glossary.sgml b/doc/src/sgml/glossary.sgml index 25b03f3b37..c517ff5b4a 100644 --- a/doc/src/sgml/glossary.sgml +++ b/doc/src/sgml/glossary.sgml @@ -1612,6 +1612,30 @@ + + Type + + + All data stored within the database is typed. Each type has both a name, and associated + properties, as well as an overarching Type, of which there are two variations. Extensible + types can created by users and comprise of: base, composite, domain, enum, and range. There + are also the system-only pseudo-types. Type records are stored in pg_type and the + overarching type is found in pg_type.typtype. + + + + + + Type Definition + + + Collective term for the various Type + variants that are allowed for pg_type.typtype catalog table column values; + specifically, ones that are extensible. + + + + Unique constraint diff --git a/doc/src/sgml/ref/create_domain.sgml b/doc/src/sgml/ref/create_domain.sgml index 81a8924926..00e1544ac8 100644 --- a/doc/src/sgml/ref/create_domain.sgml +++ b/doc/src/sgml/ref/create_domain.sgml @@ -38,8 +38,8 @@ CREATE DOMAIN name [ AS ] CREATE DOMAIN creates a new domain. A domain is - essentially a data type with optional constraints (restrictions on - the allowed set of values). + essentially a data type + with optional constraints (restrictions on the allowed set of values). The user who defines a domain becomes its owner. @@ -64,6 +64,13 @@ CREATE DOMAIN name [ AS ] USAGE privilege on the underlying type. + + + This emulates the functionality provided by + but sets the created object's + type definition + to domain. + diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml index 111f8e65d2..bbeeca7317 100644 --- a/doc/src/sgml/ref/create_type.sgml +++ b/doc/src/sgml/ref/create_type.sgml @@ -64,9 +64,10 @@ CREATE TYPE name Description - CREATE TYPE registers a new data type for use in - the current database. The user who defines a type becomes its - owner. + CREATE TYPE registers a new data + type + for use in the current database. The user who defines + a type becomes its owner. @@ -83,7 +84,10 @@ CREATE TYPE name syntax synopsis above. They respectively create a composite type, an enum type, a range type, a base type, or a shell type. The first four - of these are discussed in turn below. A shell type is simply a placeholder + of these are discussed in turn below and represent four of the five + type definitions, + with the fifth, domain, created using the command. + A shell type is simply a placeholder for a type to be defined later; it is created by issuing CREATE TYPE with no parameters except for the type name. Shell types are needed as forward references when creating range types and base types, diff --git a/doc/src/sgml/ref/drop_domain.sgml b/doc/src/sgml/ref/drop_domain.sgml index cba665fcc7..8375dd5849 100644 --- a/doc/src/sgml/ref/drop_domain.sgml +++ b/doc/src/sgml/ref/drop_domain.sgml @@ -29,10 +29,13 @@ DROP DOMAIN [ IF EXISTS ] name [, . Description - DROP DOMAIN removes a domain. Only the owner of - a domain can remove it. This duplicates the functionality provided by - but restricts the object type to domain. - + DROP DOMAIN removes a domain + type. + Only the owner of a domain can remove it. + This duplicates the functionality provided by + but restricts the object + type definition + to domain. @@ -45,7 +48,9 @@ DROP DOMAIN [ IF EXISTS ] name [, . This parameter instructs PostgreSQL to search - for the first instance of any type definition with the provided name. + for the first instance of any + type definition + with the provided name. If no type definition is found a notice is issued and the command ends. If a type definition is found then one of two things will happen: if the type definition is a domain it is dropped, otherwise the command fails. diff --git a/doc/src/sgml/ref/drop_type.sgml b/doc/src/sgml/ref/drop_type.sgml index afaa2387fe..393be721e3 100644 --- a/doc/src/sgml/ref/drop_type.sgml +++ b/doc/src/sgml/ref/drop_type.sgml @@ -29,10 +29,11 @@ DROP TYPE [ IF EXISTS ] name [, ... Description - DROP TYPE removes a user-defined data type. - Only the owner of a type can remove it. This includes domains, - though they can be targeted specifically by using the - command. + DROP TYPE removes a user-defined data + type. + Only the owner of a type can remove it. + This includes domains, though they can be targeted + specifically by using the command. @@ -45,7 +46,9 @@ DROP TYPE [ IF EXISTS ] name [, ... This parameter instructs PostgreSQL to search - for the first instance of any type definition with the provided name. + for the first instance of any + type definition + with the provided name. If no type definition is found a notice is issued and the command ends. If a type definition is found then it will be dropped.