ALTER OPERATOR <refpurpose>change the definition of an operator</refpurpose> — 演算子の定義を変更する
ALTER OPERATORname( {left_type| NONE } ,right_type) OWNER TO {new_owner| CURRENT_ROLE | CURRENT_USER | SESSION_USER } ALTER OPERATORname( {left_type| NONE } ,right_type) SET SCHEMAnew_schemaALTER OPERATORname( {left_type| NONE } ,right_type) SET ( { RESTRICT = {res_proc| NONE } | JOIN = {join_proc| NONE } | COMMUTATOR =com_op| NEGATOR =neg_op| HASHES | MERGES } [, ... ] )
<command>ALTER OPERATOR</command> changes the definition of
an operator.
ALTER OPERATORは演算子の定義を変更します。
You must own the operator to use <command>ALTER OPERATOR</command>.
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 operator's schema.
(These restrictions enforce that altering the owner
doesn't do anything you couldn't do by dropping and recreating the operator.
However, a superuser can alter ownership of any operator anyway.)
ALTER OPERATORを使用するには演算子の所有者でなければなりません。
所有者を変更するには、新しい所有者ロールに対してSET ROLEができなければなりません。また、そのロールは演算子のスキーマにおいてCREATE権限を持たなければなりません。
(この制限により、演算子の削除と再作成で行うことができない処理を所有者の変更で行えないようになります。
しかし、スーパーユーザはすべての演算子の所有者を変更することができます。)
nameThe name (optionally schema-qualified) of an existing operator. 既存の演算子の名前です(スキーマ修飾名も可)。
left_type
The data type of the operator's left operand; write
<literal>NONE</literal> if the operator has no left operand.
演算子の左オペランドのデータ型です。
左オペランドがない演算子の場合はNONEを指定します。
right_typeThe data type of the operator's right operand. 演算子の右オペランドのデータ型です。
new_ownerThe new owner of the operator. 演算子の新しい所有者です。
new_schemaThe new schema for the operator. 演算子の新しいスキーマです。
res_procThe restriction selectivity estimator function for this operator; write NONE to remove existing selectivity estimator. この演算子の制約選択評価関数です。 既存の制約選択評価関数を削除するにはNONEを指定します。
join_procThe join selectivity estimator function for this operator; write NONE to remove existing selectivity estimator. この演算子の結合選択評価関数です。 既存の結合選択評価関数を削除するにはNONEを指定します。
com_opThe commutator of this operator. Can only be changed if the operator does not have an existing commutator. この演算子の交換子。 演算子に既存の交換子がない場合にのみ変更できます。
neg_opThe negator of this operator. Can only be changed if the operator does not have an existing negator. この演算子の否定子。 演算子に既存の否定子がない場合にのみ変更できます。
HASHESIndicates this operator can support a hash join. Can only be enabled and not disabled. この演算子がハッシュ結合をサポートできることを示します。 有効にできるだけで、無効にはできません。
MERGESIndicates this operator can support a merge join. Can only be enabled and not disabled. この演算子がマージ結合をサポートできることを示します。 有効にできるだけで、無効にはできません。
Refer to <xref linkend="xoper"/> and <xref linkend="xoper-optimization"/> for further information. 詳細は36.14と36.15を参照してください。
Since commutators come in pairs that are commutators of each other,
<literal>ALTER OPERATOR SET COMMUTATOR</literal> will also set the
commutator of the <replaceable class="parameter">com_op</replaceable>
to be the target operator. Likewise, <literal>ALTER OPERATOR SET
NEGATOR</literal> will also set the negator of
the <replaceable class="parameter">neg_op</replaceable> to be the
target operator. Therefore, you must own the commutator or negator
operator as well as the target operator.
交換子は互いに交換子である対になっているので、ALTER OPERATOR SET COMMUTATORはcom_opの交換子も対象演算子に設定します。
同様に、ALTER OPERATOR SET NEGATORはneg_opの否定子も対象演算子に設定します。
したがって、対象演算子と同様に交換子または否定子演算子を所有する必要があります。
Change the owner of a custom operator <literal>a @@ b</literal> for type <type>text</type>:
text型用の独自の演算子a @@ bの所有者を変更します。
ALTER OPERATOR @@ (text, text) OWNER TO joe;
Change the restriction and join selectivity estimator functions of a
custom operator <literal>a && b</literal> for
type <type>int[]</type>:
int[]型用の独自の演算子a && bの制約および結合選択評価関数を変更します。
ALTER OPERATOR && (int[], int[]) SET (RESTRICT = _int_contsel, JOIN = _int_contjoinsel);
Mark the <literal>&&</literal> operator as being its own
commutator:
&&演算子をそれ自身の交換子として印を付けます。
ALTER OPERATOR && (int[], int[]) SET (COMMUTATOR = &&);
There is no <command>ALTER OPERATOR</command> statement in
the SQL standard.
標準SQLにはALTER OPERATOR文はありません。