ALTER PROCEDURE <refpurpose>change the definition of a procedure</refpurpose> — プロシージャの定義を変更する
ALTER PROCEDUREname[ ( [ [argmode] [argname]argtype[, ...] ] ) ]action[ ... ] [ RESTRICT ] ALTER PROCEDUREname[ ( [ [argmode] [argname]argtype[, ...] ] ) ] RENAME TOnew_nameALTER PROCEDUREname[ ( [ [argmode] [argname]argtype[, ...] ] ) ] OWNER TO {new_owner| CURRENT_ROLE | CURRENT_USER | SESSION_USER } ALTER PROCEDUREname[ ( [ [argmode] [argname]argtype[, ...] ] ) ] SET SCHEMAnew_schemaALTER PROCEDUREname[ ( [ [argmode] [argname]argtype[, ...] ] ) ] [ NO ] DEPENDS ON EXTENSIONextension_name<phrase>where <replaceable class="parameter">action</replaceable> is one of:</phrase> ここでactionは以下のいずれかです。 [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER SETconfiguration_parameter{ TO | = } {value| DEFAULT } SETconfiguration_parameterFROM CURRENT RESETconfiguration_parameterRESET ALL
<command>ALTER PROCEDURE</command> changes the definition of a
procedure.
ALTER PROCEDUREはプロシージャ定義を変更します。
You must own the procedure to use <command>ALTER PROCEDURE</command>.
To change a procedure's schema, you must also have <literal>CREATE</literal>
privilege on the new schema.
To alter the owner, you must be able to <literal>SET ROLE</literal> to the
new owning role, and that role must have <literal>CREATE</literal>
privilege on the procedure's schema.
(These restrictions enforce that altering the owner
doesn't do anything you couldn't do by dropping and recreating the procedure.
However, a superuser can alter ownership of any procedure anyway.)
ALTER PROCEDUREを使用するにはプロシージャの所有者でなければなりません。
プロシージャのスキーマを変更するには、新しいスキーマにおけるCREATE権限も必要です。
所有者を変更するには、新しい所有者ロールに対してSET ROLEができなければなりません。また、そのロールはプロシージャのスキーマにおいてCREATE権限を持たなければなりません。
(この制限により、プロシージャの削除と再作成で行うことができない処理を所有者の変更で行えないようになります。
しかし、スーパーユーザはすべての関数の所有者を変更することができます。)
nameThe name (optionally schema-qualified) of an existing procedure. If no argument list is specified, the name must be unique in its schema. 既存のプロシージャ名です(スキーマ修飾も可)。 引数リストを指定しない場合、名前はスキーマ内で一意でなければなりません。
argmode
The mode of an argument: <literal>IN</literal>, <literal>OUT</literal>,
<literal>INOUT</literal>, or <literal>VARIADIC</literal>. If omitted,
the default is <literal>IN</literal>.
引数モードで、INかOUTかINOUTかVARIADICのいずれかです。
省略した場合のデフォルトはINです。
argname
The name of an argument.
Note that <command>ALTER PROCEDURE</command> does not actually pay
any attention to argument names, since only the argument data
types are used to determine the procedure's identity.
引数の名前です。
プロシージャの識別を行うには引数のデータ型のみが使われますので、実際にはALTER PROCEDUREは引数の名前を無視することに注意してください。
argtypeThe data type(s) of the procedure's arguments (optionally schema-qualified), if any. See <xref linkend="sql-dropprocedure"/> for the details of how the procedure is looked up using the argument data type(s). もしあれば、そのプロシージャの引数のデータ型(スキーマ修飾も可)です。 引数のデータ型を使用したプロシージャ検索方法の詳細については、DROP PROCEDUREを参照してください。
new_nameThe new name of the procedure. 新たなプロシージャ名。
new_owner
The new owner of the procedure. Note that if the procedure is
marked <literal>SECURITY DEFINER</literal>, it will subsequently
execute as the new owner.
新しいプロシージャの所有者です。
プロシージャにSECURITY DEFINERが指定されている場合、その後は新しい所有者の権限でプロシージャが実行されることに注意してください。
new_schemaThe new schema for the procedure. プロシージャの新しいスキーマ。
extension_name
This form marks the procedure as dependent on the extension, or no longer
dependent on the extension if <literal>NO</literal> is specified.
A procedure that's marked as dependent on an extension is dropped when the
extension is dropped, even if cascade is not specified.
A procedure can depend upon multiple extensions, and will be dropped when
any one of those extensions is dropped.
この形式は、プロシージャが拡張機能に依存するか、NOが指定されている場合は拡張機能に依存しないことを示します。
カスケードが指定されていない場合でも、拡張機能が削除されると、拡張機能に依存しているとマークされているプロシージャは削除されます。
プロシージャは複数の拡張機能に依存することができ、これらの拡張機能のいずれかが削除されると削除されます。
[ EXTERNAL ] SECURITY INVOKER[ EXTERNAL ] SECURITY DEFINER
Change whether the procedure is a security definer or not. The
key word <literal>EXTERNAL</literal> is ignored for SQL
conformance. See <xref linkend="sql-createprocedure"/> for more information about
this capability.
プロシージャを定義者セキュリティにするか否かを変更します。
EXTERNALキーワードはSQLとの互換性のためのものであり、無視されます。
この機能の詳細についてはCREATE PROCEDUREを参照してください。
configuration_parametervalue
Add or change the assignment to be made to a configuration parameter
when the procedure is called. If
<replaceable>value</replaceable> is <literal>DEFAULT</literal>
or, equivalently, <literal>RESET</literal> is used, the procedure-local
setting is removed, so that the procedure executes with the value
present in its environment. Use <literal>RESET
ALL</literal> to clear all procedure-local settings.
<literal>SET FROM CURRENT</literal> saves the value of the parameter that
is current when <command>ALTER PROCEDURE</command> is executed as the value
to be applied when the procedure is entered.
プロシージャ呼び出し時に設定パラメータに対して行われる設定を追加または変更します。
valueがDEFAULT、またはそれと等価なRESETが使用された場合、プロシージャの局所的な設定は削除されます。
このため、プロシージャはその環境内に存在する値で実行されます。
すべてのプロシージャの局所的な設定を消去したければRESET ALLを使用してください。
SET FROM CURRENTは、ALTER PROCEDUREが実行された時点でのパラメータの現在値を、プロシージャ起動時に適用される値として保管します。
See <xref linkend="sql-set"/> and <xref linkend="runtime-config"/> for more information about allowed parameter names and values. 使用できるパラメータ名と値についての更なる詳細はSETと第19章を参照してください。
RESTRICTIgnored for conformance with the SQL standard. 標準SQLに準拠するためのものであり、無視されます。
To rename the procedure <literal>insert_data</literal> with two arguments
of type <type>integer</type> to <literal>insert_record</literal>:
integer型の二つの引数を持つプロシージャinsert_dataをinsert_recordに名前変更します。
ALTER PROCEDURE insert_data(integer, integer) RENAME TO insert_record;
To change the owner of the procedure <literal>insert_data</literal> with
two arguments of type <type>integer</type> to <literal>joe</literal>:
integer型の二つの引数を持つプロシージャinsert_dataの所有者をjoeに変更します。
ALTER PROCEDURE insert_data(integer, integer) OWNER TO joe;
To change the schema of the procedure <literal>insert_data</literal> with
two arguments of type <type>integer</type>
to <literal>accounting</literal>:
integer型の二つの引数を持つプロシージャinsert_dataのスキーマをaccountingに変更します。
ALTER PROCEDURE insert_data(integer, integer) SET SCHEMA accounting;
To mark the procedure <literal>insert_data(integer, integer)</literal> as
being dependent on the extension <literal>myext</literal>:
プロシージャinsert_data(integer, integer)を拡張myextに依存するものと印付けします。
ALTER PROCEDURE insert_data(integer, integer) DEPENDS ON EXTENSION myext;
To adjust the search path that is automatically set for a procedure: プロシージャに対して自動的に設定されるようにサーチパスを調整します。
ALTER PROCEDURE check_password(text) SET search_path = admin, pg_temp;
To disable automatic setting of <varname>search_path</varname> for a procedure:
プロシージャに対するsearch_pathの自動的な設定を無効化します。
ALTER PROCEDURE check_password(text) RESET search_path;
The procedure will now execute with whatever search path is used by its caller. このプロシージャは何であれ呼び出し側で使われるサーチパスで実行されるようになります。
This statement is partially compatible with the <command>ALTER
PROCEDURE</command> statement in the SQL standard. The standard allows more
properties of a procedure to be modified, but does not provide the
ability to rename a procedure, make a procedure a security definer,
attach configuration parameter values to a procedure,
or change the owner, schema, or volatility of a procedure. The standard also
requires the <literal>RESTRICT</literal> key word, which is optional in
<productname>PostgreSQL</productname>.
この文は標準SQLのALTER PROCEDUREと部分的に互換性があります。
標準ではより多くのプロシージャの属性を変更できますが、プロシージャの名前変更、定義者の権限で実行するかどうかの変更、設定パラメータ値の付与、および、プロシージャの所有者、スキーマ、変動性の変更は提供されません。
また、標準ではRESTRICTキーワードが必要ですが、PostgreSQLでは省略可能です。