mirror of https://github.com/postgres/postgres
parent
5bac7d11dd
commit
b256f24264
@ -0,0 +1,128 @@ |
||||
<!-- |
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_aggregate.sgml,v 1.1 2003/06/27 14:45:25 petere Exp $ |
||||
PostgreSQL documentation |
||||
--> |
||||
|
||||
<refentry id="SQL-ALTERAGGREGATE"> |
||||
<refmeta> |
||||
<refentrytitle id="SQL-ALTERAGGREGATE-TITLE">ALTER AGGREGATE</refentrytitle> |
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
||||
</refmeta> |
||||
|
||||
<refnamediv> |
||||
<refname>ALTER AGGREGATE</refname> |
||||
<refpurpose>change the definition of an aggregate function</refpurpose> |
||||
</refnamediv> |
||||
|
||||
<refsynopsisdiv> |
||||
<synopsis> |
||||
ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable> ) RENAME TO <replaceable>newname</replaceable> |
||||
</synopsis> |
||||
</refsynopsisdiv> |
||||
|
||||
<refsect1> |
||||
<title>Description</title> |
||||
|
||||
<para> |
||||
<command>ALTER AGGREGATE</command> changes the definition of an |
||||
aggregate function. The only functionality is to rename the |
||||
aggregate function. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Parameters</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><replaceable class="parameter">name</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The name (optionally schema-qualified) of an existing aggregate function. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
|
||||
<varlistentry> |
||||
<term><replaceable class="parameter">type</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The argument data type of the aggregate function, or |
||||
<literal>*</literal> if the function accepts any data type. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
|
||||
<varlistentry> |
||||
<term><replaceable class="parameter">newname</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The new name of the aggregate function. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Diagnostics</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><computeroutput>ALTER AGGREGATE</computeroutput></term> |
||||
<listitem> |
||||
<para> |
||||
Message returned if the command was successful. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Examples</title> |
||||
|
||||
<para> |
||||
To rename the aggregate function <literal>myavg</literal> for type |
||||
<type>integer</type> to <literal>my_average</literal>: |
||||
<programlisting> |
||||
ALTER AGGREGATE myavg(integer) RENAME TO my_average; |
||||
</programlisting> |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Compatibility</title> |
||||
|
||||
<para> |
||||
There is no <command>ALTER AGGREGATE</command> statement in the SQL |
||||
standard. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>See Also</title> |
||||
|
||||
<simplelist type="inline"> |
||||
<member><xref linkend="sql-createaggregate" endterm="sql-createaggregate-title"></member> |
||||
<member><xref linkend="sql-dropaggregate" endterm="sql-dropaggregate-title"></member> |
||||
</simplelist> |
||||
</refsect1> |
||||
</refentry> |
||||
|
||||
<!-- Keep this comment at the end of the file |
||||
Local variables: |
||||
mode: sgml |
||||
sgml-omittag:nil |
||||
sgml-shorttag:t |
||||
sgml-minimize-attributes:nil |
||||
sgml-always-quote-attributes:t |
||||
sgml-indent-step:1 |
||||
sgml-indent-data:t |
||||
sgml-parent-document:nil |
||||
sgml-default-dtd-file:"../reference.ced" |
||||
sgml-exposed-tags:nil |
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog" |
||||
sgml-local-ecat-files:nil |
||||
End: |
||||
--> |
@ -0,0 +1,117 @@ |
||||
<!-- |
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_conversion.sgml,v 1.1 2003/06/27 14:45:25 petere Exp $ |
||||
PostgreSQL documentation |
||||
--> |
||||
|
||||
<refentry id="SQL-ALTERCONVERSION"> |
||||
<refmeta> |
||||
<refentrytitle id="SQL-ALTERCONVERSION-TITLE">ALTER CONVERSION</refentrytitle> |
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
||||
</refmeta> |
||||
|
||||
<refnamediv> |
||||
<refname>ALTER CONVERSION</refname> |
||||
<refpurpose>change the definition of a conversion</refpurpose> |
||||
</refnamediv> |
||||
|
||||
<refsynopsisdiv> |
||||
<synopsis> |
||||
ALTER CONVERSION <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable> |
||||
</synopsis> |
||||
</refsynopsisdiv> |
||||
|
||||
<refsect1> |
||||
<title>Description</title> |
||||
|
||||
<para> |
||||
<command>ALTER CONVERSION</command> changes the definition of a |
||||
conversion. The only functionality is to rename the conversion. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Parameters</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><replaceable class="parameter">name</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The name (optionally schema-qualified) of an existing conversion. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
|
||||
<varlistentry> |
||||
<term><replaceable class="parameter">newname</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The new name of the conversion. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Diagnostics</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><computeroutput>ALTER CONVERSION</computeroutput></term> |
||||
<listitem> |
||||
<para> |
||||
Message returned if the command was successful. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Examples</title> |
||||
|
||||
<para> |
||||
To rename the conversion <literal>iso_8859_1_to_utf_8</literal> to |
||||
<literal>latin1_to_unicode</literal>: |
||||
<programlisting> |
||||
ALTER CONVERSION iso_8859_1_to_utf_8 RENAME TO latin1_to_unicode; |
||||
</programlisting> |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Compatibility</title> |
||||
|
||||
<para> |
||||
There is no <command>ALTER CONVERSION</command> statement in the SQL |
||||
standard. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>See Also</title> |
||||
|
||||
<simplelist type="inline"> |
||||
<member><xref linkend="sql-createconversion" endterm="sql-createconversion-title"></member> |
||||
<member><xref linkend="sql-dropconversion" endterm="sql-dropconversion-title"></member> |
||||
</simplelist> |
||||
</refsect1> |
||||
</refentry> |
||||
|
||||
<!-- Keep this comment at the end of the file |
||||
Local variables: |
||||
mode: sgml |
||||
sgml-omittag:nil |
||||
sgml-shorttag:t |
||||
sgml-minimize-attributes:nil |
||||
sgml-always-quote-attributes:t |
||||
sgml-indent-step:1 |
||||
sgml-indent-data:t |
||||
sgml-parent-document:nil |
||||
sgml-default-dtd-file:"../reference.ced" |
||||
sgml-exposed-tags:nil |
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog" |
||||
sgml-local-ecat-files:nil |
||||
End: |
||||
--> |
@ -0,0 +1,127 @@ |
||||
<!-- |
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_function.sgml,v 1.1 2003/06/27 14:45:25 petere Exp $ |
||||
PostgreSQL documentation |
||||
--> |
||||
|
||||
<refentry id="SQL-ALTERFUNCTION"> |
||||
<refmeta> |
||||
<refentrytitle id="SQL-ALTERFUNCTION-TITLE">ALTER FUNCTION</refentrytitle> |
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
||||
</refmeta> |
||||
|
||||
<refnamediv> |
||||
<refname>ALTER FUNCTION</refname> |
||||
<refpurpose>change the definition of a function</refpurpose> |
||||
</refnamediv> |
||||
|
||||
<refsynopsisdiv> |
||||
<synopsis> |
||||
ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) RENAME TO <replaceable>newname</replaceable> |
||||
</synopsis> |
||||
</refsynopsisdiv> |
||||
|
||||
<refsect1> |
||||
<title>Description</title> |
||||
|
||||
<para> |
||||
<command>ALTER FUNCTION</command> changes the definition of a |
||||
function. The only functionality is to rename the function. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Parameters</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><replaceable class="parameter">name</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The name (optionally schema-qualified) of an existing function. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
|
||||
<varlistentry> |
||||
<term><replaceable class="parameter">type</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The data type of an argument of the function. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
|
||||
<varlistentry> |
||||
<term><replaceable class="parameter">newname</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The new name of the function. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Diagnostics</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><computeroutput>ALTER FUNCTION</computeroutput></term> |
||||
<listitem> |
||||
<para> |
||||
Message returned if the command was successful. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Examples</title> |
||||
|
||||
<para> |
||||
To rename the function <literal>sqrt</literal> for type |
||||
<type>integer</type> to <literal>square_root</literal>: |
||||
<programlisting> |
||||
ALTER FUNCTION sqrt(integer) RENAME TO square_root; |
||||
</programlisting> |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Compatibility</title> |
||||
|
||||
<para> |
||||
There is an <command>ALTER FUNCTION</command> statement in the SQL |
||||
standard, but it does not provide the option to rename the |
||||
function. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>See Also</title> |
||||
|
||||
<simplelist type="inline"> |
||||
<member><xref linkend="sql-createfunction" endterm="sql-createfunction-title"></member> |
||||
<member><xref linkend="sql-dropfunction" endterm="sql-dropfunction-title"></member> |
||||
</simplelist> |
||||
</refsect1> |
||||
</refentry> |
||||
|
||||
<!-- Keep this comment at the end of the file |
||||
Local variables: |
||||
mode: sgml |
||||
sgml-omittag:nil |
||||
sgml-shorttag:t |
||||
sgml-minimize-attributes:nil |
||||
sgml-always-quote-attributes:t |
||||
sgml-indent-step:1 |
||||
sgml-indent-data:t |
||||
sgml-parent-document:nil |
||||
sgml-default-dtd-file:"../reference.ced" |
||||
sgml-exposed-tags:nil |
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog" |
||||
sgml-local-ecat-files:nil |
||||
End: |
||||
--> |
@ -0,0 +1,107 @@ |
||||
<!-- |
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_language.sgml,v 1.1 2003/06/27 14:45:25 petere Exp $ |
||||
PostgreSQL documentation |
||||
--> |
||||
|
||||
<refentry id="SQL-ALTERLANGUAGE"> |
||||
<refmeta> |
||||
<refentrytitle id="SQL-ALTERLANGUAGE-title">ALTER LANGUAGE</refentrytitle> |
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
||||
</refmeta> |
||||
|
||||
<refnamediv> |
||||
<refname>ALTER LANGUAGE</refname> |
||||
<refpurpose>change the definition of a procedural language</refpurpose> |
||||
</refnamediv> |
||||
|
||||
<refsynopsisdiv> |
||||
<synopsis> |
||||
ALTER LANGUAGE <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable> |
||||
</synopsis> |
||||
</refsynopsisdiv> |
||||
|
||||
<refsect1> |
||||
<title>Description</title> |
||||
|
||||
<para> |
||||
<command>ALTER LANGUAGE</command> changes the definition of a |
||||
language. The only functionality is to rename the language. Only |
||||
a superuser can rename languages. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Parameter</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><replaceable>name</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
Name of a language |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
|
||||
<varlistentry> |
||||
<term><replaceable>newname</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The new name of the language |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Diagnostics</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><computeroutput>ALTER LANGUAGE</computeroutput></term> |
||||
<listitem> |
||||
<para> |
||||
Message returned if the alteration was successful. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Compatibility</title> |
||||
|
||||
<para> |
||||
There is no <command>ALTER LANGUAGE</command> statement in the SQL |
||||
standard. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>See Also</title> |
||||
|
||||
<simplelist type="inline"> |
||||
<member><xref linkend="sql-createlanguage" endterm="sql-createlanguage-title"></member> |
||||
<member><xref linkend="sql-droplanguage" endterm="sql-droplanguage-title"></member> |
||||
</simplelist> |
||||
</refsect1> |
||||
|
||||
</refentry> |
||||
|
||||
<!-- Keep this comment at the end of the file |
||||
Local variables: |
||||
mode: sgml |
||||
sgml-omittag:nil |
||||
sgml-shorttag:t |
||||
sgml-minimize-attributes:nil |
||||
sgml-always-quote-attributes:t |
||||
sgml-indent-step:1 |
||||
sgml-indent-data:t |
||||
sgml-parent-document:nil |
||||
sgml-default-dtd-file:"../reference.ced" |
||||
sgml-exposed-tags:nil |
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog" |
||||
sgml-local-ecat-files:nil |
||||
End: |
||||
--> |
@ -0,0 +1,116 @@ |
||||
<!-- |
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_opclass.sgml,v 1.1 2003/06/27 14:45:26 petere Exp $ |
||||
PostgreSQL documentation |
||||
--> |
||||
|
||||
<refentry id="SQL-ALTEROPCLASS"> |
||||
<refmeta> |
||||
<refentrytitle id="SQL-ALTEROPCLASS-TITLE">ALTER OPERATOR CLASS</refentrytitle> |
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
||||
</refmeta> |
||||
|
||||
<refnamediv> |
||||
<refname>ALTER OPERATOR CLASS</refname> |
||||
<refpurpose>change the definition of an operator class</refpurpose> |
||||
</refnamediv> |
||||
|
||||
<refsynopsisdiv> |
||||
<synopsis> |
||||
ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable> RENAME TO <replaceable>newname</replaceable> |
||||
</synopsis> |
||||
</refsynopsisdiv> |
||||
|
||||
<refsect1> |
||||
<title>Description</title> |
||||
|
||||
<para> |
||||
<command>ALTER OPERATOR CLASS</command> changes the definition of |
||||
an operator class. The only functionality is to rename the |
||||
operator class. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Parameters</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><replaceable class="parameter">name</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The name (optionally schema-qualified) of an existing operator |
||||
class. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
|
||||
<varlistentry> |
||||
<term><replaceable class="parameter">index_method</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The name of the index method this operator class is for. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
|
||||
<varlistentry> |
||||
<term><replaceable class="parameter">newname</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The new name of the operator class. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Diagnostics</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><computeroutput>ALTER OPERATOR CLASS</computeroutput></term> |
||||
<listitem> |
||||
<para> |
||||
Message returned if the command was successful. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Compatibility</title> |
||||
|
||||
<para> |
||||
There is no <command>ALTER OPERATOR CLASS</command> statement in |
||||
the SQL standard. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>See Also</title> |
||||
|
||||
<simplelist type="inline"> |
||||
<member><xref linkend="sql-createopclass" endterm="sql-createopclass-title"></member> |
||||
<member><xref linkend="sql-dropopclass" endterm="sql-dropopclass-title"></member> |
||||
</simplelist> |
||||
</refsect1> |
||||
</refentry> |
||||
|
||||
<!-- Keep this comment at the end of the file |
||||
Local variables: |
||||
mode: sgml |
||||
sgml-omittag:nil |
||||
sgml-shorttag:t |
||||
sgml-minimize-attributes:nil |
||||
sgml-always-quote-attributes:t |
||||
sgml-indent-step:1 |
||||
sgml-indent-data:t |
||||
sgml-parent-document:nil |
||||
sgml-default-dtd-file:"../reference.ced" |
||||
sgml-exposed-tags:nil |
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog" |
||||
sgml-local-ecat-files:nil |
||||
End: |
||||
--> |
@ -0,0 +1,108 @@ |
||||
<!-- |
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_schema.sgml,v 1.1 2003/06/27 14:45:26 petere Exp $ |
||||
PostgreSQL documentation |
||||
--> |
||||
|
||||
<refentry id="SQL-ALTERSCHEMA"> |
||||
<refmeta> |
||||
<refentrytitle id="SQL-ALTERSCHEMA-title">ALTER SCHEMA</refentrytitle> |
||||
<refmiscinfo>SQL - Schema Statements</refmiscinfo> |
||||
</refmeta> |
||||
|
||||
<refnamediv> |
||||
<refname>ALTER SCHEMA</refname> |
||||
<refpurpose>change the definition of a schema</refpurpose> |
||||
</refnamediv> |
||||
|
||||
<refsynopsisdiv> |
||||
<synopsis> |
||||
ALTER SCHEMA <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable> |
||||
</synopsis> |
||||
</refsynopsisdiv> |
||||
|
||||
<refsect1> |
||||
<title>Description</title> |
||||
|
||||
<para> |
||||
<command>ALTER SCHEMA</command> 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 |
||||
<literal>CREATE</literal> for the database. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Parameter</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><replaceable>name</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
Name of a schema |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
|
||||
<varlistentry> |
||||
<term><replaceable>newname</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
The new name of the schema |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Diagnostics</title> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><computeroutput>ALTER SCHEMA</computeroutput></term> |
||||
<listitem> |
||||
<para> |
||||
Message returned if the alteration was successful. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>Compatibility</title> |
||||
|
||||
<para> |
||||
There is no <command>ALTER SCHEMA</command> statement in the SQL |
||||
standard. |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1> |
||||
<title>See Also</title> |
||||
|
||||
<simplelist type="inline"> |
||||
<member><xref linkend="sql-createschema" endterm="sql-createschema-title"></member> |
||||
<member><xref linkend="sql-dropschema" endterm="sql-dropschema-title"></member> |
||||
</simplelist> |
||||
</refsect1> |
||||
|
||||
</refentry> |
||||
|
||||
<!-- Keep this comment at the end of the file |
||||
Local variables: |
||||
mode: sgml |
||||
sgml-omittag:nil |
||||
sgml-shorttag:t |
||||
sgml-minimize-attributes:nil |
||||
sgml-always-quote-attributes:t |
||||
sgml-indent-step:1 |
||||
sgml-indent-data:t |
||||
sgml-parent-document:nil |
||||
sgml-default-dtd-file:"../reference.ced" |
||||
sgml-exposed-tags:nil |
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog" |
||||
sgml-local-ecat-files:nil |
||||
End: |
||||
--> |
@ -0,0 +1,159 @@ |
||||
/*-------------------------------------------------------------------------
|
||||
* |
||||
* alter.c |
||||
* Drivers for generic alter commands |
||||
* |
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group |
||||
* Portions Copyright (c) 1994, Regents of the University of California |
||||
* |
||||
* |
||||
* IDENTIFICATION |
||||
* $Header: /cvsroot/pgsql/src/backend/commands/alter.c,v 1.1 2003/06/27 14:45:27 petere Exp $ |
||||
* |
||||
*------------------------------------------------------------------------- |
||||
*/ |
||||
#include "postgres.h" |
||||
|
||||
#include "access/htup.h" |
||||
#include "catalog/catalog.h" |
||||
#include "catalog/namespace.h" |
||||
#include "catalog/pg_class.h" |
||||
#include "commands/alter.h" |
||||
#include "commands/conversioncmds.h" |
||||
#include "commands/dbcommands.h" |
||||
#include "commands/defrem.h" |
||||
#include "commands/proclang.h" |
||||
#include "commands/schemacmds.h" |
||||
#include "commands/tablecmds.h" |
||||
#include "commands/trigger.h" |
||||
#include "commands/user.h" |
||||
#include "miscadmin.h" |
||||
#include "parser/parse_clause.h" |
||||
#include "utils/acl.h" |
||||
#include "utils/lsyscache.h" |
||||
#include "utils/syscache.h" |
||||
|
||||
|
||||
static void |
||||
CheckOwnership(RangeVar *rel, bool noCatalogs) |
||||
{ |
||||
Oid relOid; |
||||
HeapTuple tuple; |
||||
|
||||
relOid = RangeVarGetRelid(rel, false); |
||||
tuple = SearchSysCache(RELOID, |
||||
ObjectIdGetDatum(relOid), |
||||
0, 0, 0); |
||||
if (!HeapTupleIsValid(tuple)) |
||||
elog(ERROR, "Relation \"%s\" does not exist", rel->relname); |
||||
|
||||
if (!pg_class_ownercheck(relOid, GetUserId())) |
||||
aclcheck_error(ACLCHECK_NOT_OWNER, rel->relname); |
||||
|
||||
if (noCatalogs) |
||||
{ |
||||
if (!allowSystemTableMods && |
||||
IsSystemClass((Form_pg_class) GETSTRUCT(tuple))) |
||||
elog(ERROR, "relation \"%s\" is a system catalog", |
||||
rel->relname); |
||||
} |
||||
|
||||
ReleaseSysCache(tuple); |
||||
} |
||||
|
||||
|
||||
void |
||||
ExecRenameStmt(RenameStmt *stmt) |
||||
{ |
||||
switch (stmt->renameType) |
||||
{ |
||||
case OBJECT_AGGREGATE: |
||||
RenameAggregate(stmt->object, (TypeName *) lfirst(stmt->objarg), stmt->newname); |
||||
break; |
||||
|
||||
case OBJECT_CONVERSION: |
||||
RenameConversion(stmt->object, stmt->newname); |
||||
break; |
||||
|
||||
case OBJECT_DATABASE: |
||||
RenameDatabase(stmt->subname, stmt->newname); |
||||
break; |
||||
|
||||
case OBJECT_FUNCTION: |
||||
RenameFunction(stmt->object, stmt->objarg, stmt->newname); |
||||
break; |
||||
|
||||
case OBJECT_GROUP: |
||||
RenameGroup(stmt->subname, stmt->newname); |
||||
break; |
||||
|
||||
case OBJECT_LANGUAGE: |
||||
RenameLanguage(stmt->subname, stmt->newname); |
||||
break; |
||||
|
||||
case OBJECT_OPCLASS: |
||||
RenameOpClass(stmt->object, stmt->subname, stmt->newname); |
||||
break; |
||||
|
||||
case OBJECT_SCHEMA: |
||||
RenameSchema(stmt->subname, stmt->newname); |
||||
break; |
||||
|
||||
case OBJECT_USER: |
||||
RenameUser(stmt->subname, stmt->newname); |
||||
break; |
||||
|
||||
case OBJECT_TABLE: |
||||
case OBJECT_COLUMN: |
||||
case OBJECT_TRIGGER: |
||||
{ |
||||
Oid relid; |
||||
|
||||
CheckOwnership(stmt->relation, true); |
||||
|
||||
relid = RangeVarGetRelid(stmt->relation, false); |
||||
|
||||
switch (stmt->renameType) |
||||
{ |
||||
case OBJECT_TABLE: |
||||
{ |
||||
/*
|
||||
* RENAME TABLE requires that we (still) hold |
||||
* CREATE rights on the containing namespace, as |
||||
* well as ownership of the table. |
||||
*/ |
||||
Oid namespaceId = get_rel_namespace(relid); |
||||
AclResult aclresult; |
||||
|
||||
aclresult = pg_namespace_aclcheck(namespaceId, |
||||
GetUserId(), |
||||
ACL_CREATE); |
||||
if (aclresult != ACLCHECK_OK) |
||||
aclcheck_error(aclresult, |
||||
get_namespace_name(namespaceId)); |
||||
|
||||
renamerel(relid, stmt->newname); |
||||
break; |
||||
} |
||||
case OBJECT_COLUMN: |
||||
renameatt(relid, |
||||
stmt->subname, /* old att name */ |
||||
stmt->newname, /* new att name */ |
||||
interpretInhOption(stmt->relation->inhOpt), /* recursive? */ |
||||
false); /* recursing already? */ |
||||
break; |
||||
case OBJECT_TRIGGER: |
||||
renametrig(relid, |
||||
stmt->subname, /* old att name */ |
||||
stmt->newname); /* new att name */ |
||||
break; |
||||
default: |
||||
/*can't happen*/; |
||||
} |
||||
break; |
||||
} |
||||
|
||||
default: |
||||
elog(ERROR, "invalid object type for RenameStmt: %d", stmt->renameType); |
||||
} |
||||
} |
@ -0,0 +1,21 @@ |
||||
/*-------------------------------------------------------------------------
|
||||
* |
||||
* alter.h |
||||
* prototypes for alter.h |
||||
* |
||||
* |
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group |
||||
* Portions Copyright (c) 1994, Regents of the University of California |
||||
* |
||||
* $Id: alter.h,v 1.1 2003/06/27 14:45:31 petere Exp $ |
||||
* |
||||
*------------------------------------------------------------------------- |
||||
*/ |
||||
#ifndef ALTER_H |
||||
#define ALTER_H |
||||
|
||||
#include "nodes/parsenodes.h" |
||||
|
||||
extern void ExecRenameStmt(RenameStmt *stmt); |
||||
|
||||
#endif /* ALTER_H */ |
Loading…
Reference in new issue