From 0adfa2c39d567394f423c69bfaf467d0d00ee3df Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 25 Jun 2004 21:55:59 +0000 Subject: Support renaming of tablespaces, and changing the owners of aggregates, conversions, functions, operators, operator classes, schemas, types, and tablespaces. Fold the existing implementations of alter domain owner and alter database owner in with these. Christopher Kings-Lynne --- doc/src/sgml/ref/allfiles.sgml | 5 +- doc/src/sgml/ref/alter_aggregate.sgml | 24 +++++- doc/src/sgml/ref/alter_conversion.sgml | 22 +++++- doc/src/sgml/ref/alter_function.sgml | 28 ++++++- doc/src/sgml/ref/alter_opclass.sgml | 18 ++++- doc/src/sgml/ref/alter_operator.sgml | 127 ++++++++++++++++++++++++++++++++ doc/src/sgml/ref/alter_schema.sgml | 24 ++++-- doc/src/sgml/ref/alter_tablespace.sgml | 125 +++++++++++++++++++++++++++++++ doc/src/sgml/ref/alter_type.sgml | 106 ++++++++++++++++++++++++++ doc/src/sgml/ref/create_operator.sgml | 53 ++++++------- doc/src/sgml/ref/create_schema.sgml | 6 +- doc/src/sgml/ref/create_tablespace.sgml | 7 +- doc/src/sgml/ref/create_type.sgml | 3 +- doc/src/sgml/ref/drop_operator.sgml | 5 +- doc/src/sgml/ref/drop_tablespace.sgml | 3 +- doc/src/sgml/ref/drop_type.sgml | 3 +- doc/src/sgml/reference.sgml | 5 +- 17 files changed, 509 insertions(+), 55 deletions(-) create mode 100644 doc/src/sgml/ref/alter_operator.sgml create mode 100644 doc/src/sgml/ref/alter_tablespace.sgml create mode 100644 doc/src/sgml/ref/alter_type.sgml (limited to 'doc/src') diff --git a/doc/src/sgml/ref/allfiles.sgml b/doc/src/sgml/ref/allfiles.sgml index f21410e7c13..f02edd4cff2 100644 --- a/doc/src/sgml/ref/allfiles.sgml +++ b/doc/src/sgml/ref/allfiles.sgml @@ -1,5 +1,5 @@ @@ -13,11 +13,14 @@ Complete list of usable sgml source files in this directory. + + + diff --git a/doc/src/sgml/ref/alter_aggregate.sgml b/doc/src/sgml/ref/alter_aggregate.sgml index 112242f1421..bfdb1761d5b 100644 --- a/doc/src/sgml/ref/alter_aggregate.sgml +++ b/doc/src/sgml/ref/alter_aggregate.sgml @@ -1,5 +1,5 @@ @@ -21,6 +21,7 @@ PostgreSQL documentation ALTER AGGREGATE name ( type ) RENAME TO newname +ALTER AGGREGATE name ( type ) OWNER TO newowner @@ -29,8 +30,7 @@ ALTER AGGREGATE name ( type ALTER AGGREGATE changes the definition of an - aggregate function. The only currently available functionality is to - rename the aggregate function. + aggregate function. @@ -65,6 +65,16 @@ ALTER AGGREGATE name ( type + + + newowner + + + The new owner of the aggregate function. + You must be a superuser to change an aggregate's owner. + + + @@ -76,6 +86,14 @@ ALTER AGGREGATE name ( typeinteger to my_average: ALTER AGGREGATE myavg(integer) RENAME TO my_average; + + + + + To change the owner of the aggregate function myavg for type + integer to joe: + +ALTER AGGREGATE myavg(integer) OWNER TO joe; diff --git a/doc/src/sgml/ref/alter_conversion.sgml b/doc/src/sgml/ref/alter_conversion.sgml index 08d167eb3cc..024d03212cb 100644 --- a/doc/src/sgml/ref/alter_conversion.sgml +++ b/doc/src/sgml/ref/alter_conversion.sgml @@ -1,5 +1,5 @@ @@ -21,6 +21,7 @@ PostgreSQL documentation ALTER CONVERSION name RENAME TO newname +ALTER CONVERSION name OWNER TO newowner @@ -29,7 +30,6 @@ ALTER CONVERSION name RENAME TO newname< ALTER CONVERSION changes the definition of a - conversion. The only currently available functionality is to rename the conversion. @@ -55,6 +55,16 @@ ALTER CONVERSION name RENAME TO newname< + + + newowner + + + The new owner of the conversion. To change the owner of a conversion, + you must be a superuser. + + + @@ -66,6 +76,14 @@ ALTER CONVERSION name RENAME TO newname< latin1_to_unicode: ALTER CONVERSION iso_8859_1_to_utf_8 RENAME TO latin1_to_unicode; + + + + + To change the owner of the conversion iso_8859_1_to_utf_8 to + joe: + +ALTER CONVERSION iso_8859_1_to_utf_8 OWNER TO joe; diff --git a/doc/src/sgml/ref/alter_function.sgml b/doc/src/sgml/ref/alter_function.sgml index 71ae81893b3..00dfcac007a 100644 --- a/doc/src/sgml/ref/alter_function.sgml +++ b/doc/src/sgml/ref/alter_function.sgml @@ -1,5 +1,5 @@ @@ -21,6 +21,7 @@ PostgreSQL documentation ALTER FUNCTION name ( [ type [, ...] ] ) RENAME TO newname +ALTER FUNCTION name ( [ type [, ...] ] ) OWNER TO newowner @@ -29,7 +30,7 @@ ALTER FUNCTION name ( [ + + + newowner + + + The new owner of the function. + To change the owner of a function, you must be a superuser. + Note that if the function is marked + SECURITY DEFINER, + it will subsequently execute as the new owner. + + + @@ -74,6 +88,14 @@ ALTER FUNCTION name ( [ index_method RENAME TO newname +ALTER OPERATOR CLASS name USING index_method OWNER TO newowner @@ -29,8 +30,7 @@ ALTER OPERATOR CLASS name USING - + + + newowner + + + The new owner of the operator class. + You must be a superuser to change the owner of an operator class. + + + + diff --git a/doc/src/sgml/ref/alter_operator.sgml b/doc/src/sgml/ref/alter_operator.sgml new file mode 100644 index 00000000000..cfec153f2bb --- /dev/null +++ b/doc/src/sgml/ref/alter_operator.sgml @@ -0,0 +1,127 @@ + + + + + ALTER OPERATOR + SQL - Language Statements + + + + ALTER OPERATOR + change the definition of an operator + + + + ALTER OPERATOR + + + + +ALTER OPERATOR name ( { lefttype | NONE } , { righttype | NONE } ) OWNER TO newowner + + + + + Description + + + ALTER OPERATOR changes the definition of + an operator. The only currently available functionality is to change the + owner of the operator. + + + + + Parameters + + + + name + + + The name (optionally schema-qualified) of an existing operator. + + + + + + lefttype + + + The data type of the operator's left operand; write + NONE if the operator has no left operand. + + + + + + righttype + + + The data type of the operator's right operand; write + NONE if the operator has no right operand. + + + + + + newowner + + + The new owner of the operator. + You must be a superuser to change the owner of an operator. + + + + + + + + Examples + + + Change the owner of a custom operator a @@ b for type text: + +ALTER OPERATOR @@ (text, text) OWNER TO joe; + + + + + + Compatibility + + + There is no ALTER OPERATOR statement in + the SQL standard. + + + + + See Also + + + + + + + + + diff --git a/doc/src/sgml/ref/alter_schema.sgml b/doc/src/sgml/ref/alter_schema.sgml index 866db728689..702df1da396 100644 --- a/doc/src/sgml/ref/alter_schema.sgml +++ b/doc/src/sgml/ref/alter_schema.sgml @@ -1,5 +1,5 @@ @@ -21,6 +21,7 @@ PostgreSQL documentation ALTER SCHEMA name RENAME TO newname +ALTER SCHEMA name OWNER TO newowner @@ -29,9 +30,9 @@ ALTER SCHEMA name RENAME TO newname ALTER SCHEMA changes the definition of a schema. - The only functionality is to rename the schema. To rename a schema - you must own the schema and have the privilege - CREATE for the database. + To rename a schema you must own the schema and have the privilege + CREATE for the database. To change the owner + of a schema, you must be a superuser. @@ -43,7 +44,7 @@ ALTER SCHEMA name RENAME TO newnamename - Name of a schema + The name of an existing schema. @@ -52,7 +53,18 @@ ALTER SCHEMA name RENAME TO newnamenewname - The new name of the schema + The new name of the schema. The new name cannot + begin with pg_, as such names + are reserved for system schemas. + + + + + + newowner + + + The new owner of the schema. diff --git a/doc/src/sgml/ref/alter_tablespace.sgml b/doc/src/sgml/ref/alter_tablespace.sgml new file mode 100644 index 00000000000..bdfe4b81553 --- /dev/null +++ b/doc/src/sgml/ref/alter_tablespace.sgml @@ -0,0 +1,125 @@ + + + + + ALTER TABLESPACE + SQL - Language Statements + + + + ALTER TABLESPACE + change the definition of a tablespace + + + + ALTER TABLESPACE + + + + +ALTER TABLESPACE name RENAME TO newname +ALTER TABLESPACE name OWNER TO newowner + + + + + Description + + + ALTER TABLESPACE changes the definition of + a tablespace. + + + + + Parameters + + + + name + + + The name of an existing tablespace. + + + + + + newname + + + The new name of the tablespace. The new name cannot + begin with pg_, as such names + are reserved for system tablespaces. + + + + + + newowner + + + The new owner of the tablespace. + You must be a superuser to change the owner of a tablespace. + + + + + + + + Examples + + + Rename tablespace index_space to fast_raid: + +ALTER TABLESPACE index_space RENAME TO fast_raid; + + + + + Change the owner of tablespace index_space: + +ALTER TABLESPACE index_space OWNER TO mary; + + + + + + Compatibility + + + There is no ALTER TABLESPACE statement in + the SQL standard. + + + + + See Also + + + + + + + + + diff --git a/doc/src/sgml/ref/alter_type.sgml b/doc/src/sgml/ref/alter_type.sgml new file mode 100644 index 00000000000..33830c04c04 --- /dev/null +++ b/doc/src/sgml/ref/alter_type.sgml @@ -0,0 +1,106 @@ + + + + + ALTER TYPE + SQL - Language Statements + + + + + ALTER TYPE + + + change the definition of a type + + + + + ALTER TYPE + + + + +ALTER TYPE name OWNER TO new_owner + + + + + Description + + + ALTER TYPE changes the definition of an existing type. + The only currently available capability is changing the owner of a type. + + + + + Parameters + + + + + name + + + The name (possibly schema-qualified) of an existing type to + alter. + + + + + + new_owner + + + The user name of the new owner of the type. + You must be a superuser to change a type's owner. + + + + + + + + + + Examples + + + To change the owner of the user-defined type email + to joe: + +ALTER TYPE email OWNER TO joe; + + + + + + Compatibility + + + There is no ALTER TYPE statement in the SQL + standard. + + + + + diff --git a/doc/src/sgml/ref/create_operator.sgml b/doc/src/sgml/ref/create_operator.sgml index 1001b8f33fb..029d1af0d90 100644 --- a/doc/src/sgml/ref/create_operator.sgml +++ b/doc/src/sgml/ref/create_operator.sgml @@ -1,5 +1,5 @@ @@ -109,13 +109,13 @@ CREATE OPERATOR name ( name - The name of the operator to be defined. See above for allowable - characters. The name may be schema-qualified, for example - CREATE OPERATOR myschema.+ (...). If not, then - the operator is created in the current schema. Two operators - in the same schema can have the same name if they operate on - different data types. This is called - overloading. + The name of the operator to be defined. See above for allowable + characters. The name may be schema-qualified, for example + CREATE OPERATOR myschema.+ (...). If not, then + the operator is created in the current schema. Two operators + in the same schema can have the same name if they operate on + different data types. This is called + overloading. @@ -124,7 +124,7 @@ CREATE OPERATOR name ( funcname - The function used to implement this operator. + The function used to implement this operator. @@ -133,8 +133,8 @@ CREATE OPERATOR name ( lefttype - The data type of the operator's left operand, if any. - This option would be omitted for a left-unary operator. + The data type of the operator's left operand, if any. + This option would be omitted for a left-unary operator. @@ -143,8 +143,8 @@ CREATE OPERATOR name ( righttype - The data type of the operator's right operand, if any. - This option would be omitted for a right-unary operator. + The data type of the operator's right operand, if any. + This option would be omitted for a right-unary operator. @@ -153,7 +153,7 @@ CREATE OPERATOR name ( com_op - The commutator of this operator. + The commutator of this operator. @@ -162,7 +162,7 @@ CREATE OPERATOR name ( neg_op - The negator of this operator. + The negator of this operator. @@ -171,7 +171,7 @@ CREATE OPERATOR name ( res_proc - The restriction selectivity estimator function for this operator. + The restriction selectivity estimator function for this operator. @@ -180,7 +180,7 @@ CREATE OPERATOR name ( join_proc - The join selectivity estimator function for this operator. + The join selectivity estimator function for this operator. @@ -207,8 +207,8 @@ CREATE OPERATOR name ( left_sort_op - If this operator can support a merge join, the less-than - operator that sorts the left-hand data type of this operator. + If this operator can support a merge join, the less-than + operator that sorts the left-hand data type of this operator. @@ -217,8 +217,8 @@ CREATE OPERATOR name ( right_sort_op - If this operator can support a merge join, the less-than - operator that sorts the right-hand data type of this operator. + If this operator can support a merge join, the less-than + operator that sorts the right-hand data type of this operator. @@ -227,8 +227,8 @@ CREATE OPERATOR name ( less_than_op - If this operator can support a merge join, the less-than - operator that compares the input data types of this operator. + If this operator can support a merge join, the less-than + operator that compares the input data types of this operator. @@ -237,8 +237,8 @@ CREATE OPERATOR name ( greater_than_op - If this operator can support a merge join, the greater-than - operator that compares the input data types of this operator. + If this operator can support a merge join, the greater-than + operator that compares the input data types of this operator. @@ -263,7 +263,8 @@ COMMUTATOR = OPERATOR(myschema.===) , Use DROP OPERATOR to delete user-defined - operators from a database. + operators from a database. Use ALTER OPERATOR + to modify operators in a database. diff --git a/doc/src/sgml/ref/create_schema.sgml b/doc/src/sgml/ref/create_schema.sgml index 8668612cc6a..4f56341ce36 100644 --- a/doc/src/sgml/ref/create_schema.sgml +++ b/doc/src/sgml/ref/create_schema.sgml @@ -1,5 +1,5 @@ @@ -64,7 +64,9 @@ CREATE SCHEMA AUTHORIZATION username The name of a schema to be created. If this is omitted, the user name - is used as the schema name. + is used as the schema name. The name cannot + begin with pg_, as such names + are reserved for system schemas. diff --git a/doc/src/sgml/ref/create_tablespace.sgml b/doc/src/sgml/ref/create_tablespace.sgml index 9f670a817d6..08ff4e3254b 100644 --- a/doc/src/sgml/ref/create_tablespace.sgml +++ b/doc/src/sgml/ref/create_tablespace.sgml @@ -1,5 +1,5 @@ @@ -56,7 +56,9 @@ CREATE TABLESPACE tablespacename [ tablespacename - The name of a tablespace to be created. + The name of a tablespace to be created. The name cannot + begin with pg_, as such names + are reserved for system tablespaces. @@ -133,6 +135,7 @@ CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes'; + diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml index b35a1805ca4..b7d1ac64e0a 100644 --- a/doc/src/sgml/ref/create_type.sgml +++ b/doc/src/sgml/ref/create_type.sgml @@ -1,5 +1,5 @@ @@ -546,6 +546,7 @@ CREATE TABLE big_objs ( + diff --git a/doc/src/sgml/ref/drop_operator.sgml b/doc/src/sgml/ref/drop_operator.sgml index 5b17ebec1b5..b928e721936 100644 --- a/doc/src/sgml/ref/drop_operator.sgml +++ b/doc/src/sgml/ref/drop_operator.sgml @@ -1,5 +1,5 @@ @@ -20,7 +20,7 @@ PostgreSQL documentation -DROP OPERATOR name ( lefttype | NONE , righttype | NONE ) [ CASCADE | RESTRICT ] +DROP OPERATOR name ( { lefttype | NONE } , { righttype | NONE } ) [ CASCADE | RESTRICT ] @@ -128,6 +128,7 @@ DROP OPERATOR ! (bigint, none); + diff --git a/doc/src/sgml/ref/drop_tablespace.sgml b/doc/src/sgml/ref/drop_tablespace.sgml index ba8415208e3..bd4fb6dcd5e 100644 --- a/doc/src/sgml/ref/drop_tablespace.sgml +++ b/doc/src/sgml/ref/drop_tablespace.sgml @@ -1,5 +1,5 @@ @@ -80,6 +80,7 @@ DROP TABLESPACE mystuff; + diff --git a/doc/src/sgml/ref/drop_type.sgml b/doc/src/sgml/ref/drop_type.sgml index 3ac172b5b4b..da0f6bc8b63 100644 --- a/doc/src/sgml/ref/drop_type.sgml +++ b/doc/src/sgml/ref/drop_type.sgml @@ -1,5 +1,5 @@ @@ -95,6 +95,7 @@ DROP TYPE box; + diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml index b5d42361ce7..5230e07119e 100644 --- a/doc/src/sgml/reference.sgml +++ b/doc/src/sgml/reference.sgml @@ -1,5 +1,5 @@ @@ -45,11 +45,14 @@ PostgreSQL Reference Manual &alterFunction; &alterGroup; &alterLanguage; + &alterOperator; &alterOperatorClass; &alterSchema; &alterSequence; &alterTable; + &alterTableSpace; &alterTrigger; + &alterType; &alterUser; &analyze; &begin; -- cgit v1.2.3