-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add CREATE OPERATOR docs page Do all steps in creating a docs page for `CREATE OPERATOR`. Reference Postgres docs in semantics. Add a single, basic example. * Add DROP OPERATOR docs page Add a docs page for `DROP OPERATOR`. Have semantics refer to the Postgres docs. Have one basic example. * Address @ndeodhar's review comments * Add `DROP OPERATOR` to one of the index files * Add expected output for the `CREATE OPERATOR`example * Fix the grammar for `DROP OPERATOR` to not only be correct but also have a nicer looking diagram * Fix and improve the grammar for DROP AGGREGATE Just like the fix on `DROP OPERATOR`, do the same for `DROP AGGREGATE`. The grammar should be fixed, and the diagram should look a lot nicer.
- Loading branch information
Showing
14 changed files
with
281 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
docs/content/latest/api/ysql/commands/ddl_create_operator.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: CREATE OPERATOR | ||
linkTitle: CREATE OPERATOR | ||
summary: Create a new operator | ||
description: CREATE OPERATOR | ||
menu: | ||
latest: | ||
identifier: api-ysql-commands-create-operator | ||
parent: api-ysql-commands | ||
aliases: | ||
- /latest/api/ysql/ddl_create_operator/ | ||
isTocNested: true | ||
showAsideToc: true | ||
--- | ||
|
||
## Synopsis | ||
|
||
Use the `CREATE OPERATOR` statement to create a new operator. | ||
|
||
## Syntax | ||
|
||
<ul class="nav nav-tabs nav-tabs-yb"> | ||
<li > | ||
<a href="#grammar" class="nav-link active" id="grammar-tab" data-toggle="tab" role="tab" aria-controls="grammar" aria-selected="true"> | ||
<i class="fas fa-file-alt" aria-hidden="true"></i> | ||
Grammar | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#diagram" class="nav-link" id="diagram-tab" data-toggle="tab" role="tab" aria-controls="diagram" aria-selected="false"> | ||
<i class="fas fa-project-diagram" aria-hidden="true"></i> | ||
Diagram | ||
</a> | ||
</li> | ||
</ul> | ||
|
||
<div class="tab-content"> | ||
<div id="grammar" class="tab-pane fade show active" role="tabpanel" aria-labelledby="grammar-tab"> | ||
{{% includeMarkdown "../syntax_resources/commands/create_operator,operator_option.grammar.md" /%}} | ||
</div> | ||
<div id="diagram" class="tab-pane fade" role="tabpanel" aria-labelledby="diagram-tab"> | ||
{{% includeMarkdown "../syntax_resources/commands/create_operator,operator_option.diagram.md" /%}} | ||
</div> | ||
</div> | ||
|
||
## Semantics | ||
|
||
See the semantics of each option in the [PostgreSQL docs][postgresql-docs-create-operator]. | ||
|
||
## Examples | ||
|
||
Basic example. | ||
|
||
```sql | ||
yugabyte=# CREATE OPERATOR @#@ ( | ||
rightarg = int8, | ||
procedure = numeric_fac | ||
); | ||
yugabyte=# SELECT @#@ 5; | ||
``` | ||
|
||
``` | ||
?column? | ||
---------- | ||
120 | ||
``` | ||
|
||
## See also | ||
|
||
- [`DROP OPERATOR`](../ddl_drop_operator) | ||
|
||
[postgresql-docs-create-operator]: https://www.postgresql.org/docs/current/sql-createoperator.html |
66 changes: 66 additions & 0 deletions
66
docs/content/latest/api/ysql/commands/ddl_drop_operator.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
title: DROP OPERATOR | ||
linkTitle: DROP OPERATOR | ||
summary: Remove an operator | ||
description: DROP OPERATOR | ||
menu: | ||
latest: | ||
identifier: api-ysql-commands-drop-operator | ||
parent: api-ysql-commands | ||
aliases: | ||
- /latest/api/ysql/ddl_drop_operator/ | ||
isTocNested: true | ||
showAsideToc: true | ||
--- | ||
|
||
## Synopsis | ||
|
||
Use the `DROP OPERATOR` statement to remove an operator. | ||
|
||
## Syntax | ||
|
||
<ul class="nav nav-tabs nav-tabs-yb"> | ||
<li > | ||
<a href="#grammar" class="nav-link active" id="grammar-tab" data-toggle="tab" role="tab" aria-controls="grammar" aria-selected="true"> | ||
<i class="fas fa-file-alt" aria-hidden="true"></i> | ||
Grammar | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#diagram" class="nav-link" id="diagram-tab" data-toggle="tab" role="tab" aria-controls="diagram" aria-selected="false"> | ||
<i class="fas fa-project-diagram" aria-hidden="true"></i> | ||
Diagram | ||
</a> | ||
</li> | ||
</ul> | ||
|
||
<div class="tab-content"> | ||
<div id="grammar" class="tab-pane fade show active" role="tabpanel" aria-labelledby="grammar-tab"> | ||
{{% includeMarkdown "../syntax_resources/commands/drop_operator,operator_signature.grammar.md" /%}} | ||
</div> | ||
<div id="diagram" class="tab-pane fade" role="tabpanel" aria-labelledby="diagram-tab"> | ||
{{% includeMarkdown "../syntax_resources/commands/drop_operator,operator_signature.diagram.md" /%}} | ||
</div> | ||
</div> | ||
|
||
## Semantics | ||
|
||
See the semantics of each option in the [PostgreSQL docs][postgresql-docs-drop-operator]. | ||
|
||
## Examples | ||
|
||
Basic example. | ||
|
||
```sql | ||
yugabyte=# CREATE OPERATOR @#@ ( | ||
rightarg = int8, | ||
procedure = numeric_fac | ||
); | ||
yugabyte=# DROP OPERATOR @#@ (NONE, int8); | ||
``` | ||
|
||
## See also | ||
|
||
- [`CREATE OPERATOR`](../ddl_create_operator) | ||
|
||
[postgresql-docs-drop-operator]: https://www.postgresql.org/docs/current/sql-dropoperator.html |
2 changes: 1 addition & 1 deletion
2
docs/content/latest/api/ysql/syntax_resources/commands/comment_on.diagram.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...t/api/ysql/syntax_resources/commands/create_operator,operator_option.diagram.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#### create_operator | ||
|
||
<svg class="rrdiagram" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="937" height="80" viewbox="0 0 937 80"><path class="connector" d="M0 37h15m67 0h10m84 0h10m112 0h10m25 0h30m83 0h10m30 0h10m111 0h41m-300 0q5 0 5 5v20q0 5 5 5h5m94 0h10m30 0h10m121 0h5q5 0 5-5v-20q0-5 5-5m5 0h50m-5 0q-5 0-5-5v-17q0-5 5-5h159q5 0 5 5v17q0 5-5 5m-130 0h10m115 0h40m-224 0q5 0 5 5v8q0 5 5 5h199q5 0 5-5v-8q0-5 5-5m5 0h10m25 0h15"/><polygon points="0,44 5,37 0,30" style="fill:black;stroke-width:0"/><rect class="literal" x="15" y="20" width="67" height="25" rx="7"/><text class="text" x="25" y="37">CREATE</text><rect class="literal" x="92" y="20" width="84" height="25" rx="7"/><text class="text" x="102" y="37">OPERATOR</text><a xlink:href="../../syntax_resources/grammar_diagrams#operator-name"><rect class="rule" x="186" y="20" width="112" height="25"/><text class="text" x="196" y="37">operator_name</text></a><rect class="literal" x="308" y="20" width="25" height="25" rx="7"/><text class="text" x="318" y="37">(</text><rect class="literal" x="363" y="20" width="83" height="25" rx="7"/><text class="text" x="373" y="37">FUNCTION</text><rect class="literal" x="456" y="20" width="30" height="25" rx="7"/><text class="text" x="466" y="37">=</text><a xlink:href="../../syntax_resources/grammar_diagrams#function-name"><rect class="rule" x="496" y="20" width="111" height="25"/><text class="text" x="506" y="37">function_name</text></a><rect class="literal" x="363" y="50" width="94" height="25" rx="7"/><text class="text" x="373" y="67">PROCEDURE</text><rect class="literal" x="467" y="50" width="30" height="25" rx="7"/><text class="text" x="477" y="67">=</text><a xlink:href="../../syntax_resources/grammar_diagrams#procedure-name"><rect class="rule" x="507" y="50" width="121" height="25"/><text class="text" x="517" y="67">procedure_name</text></a><rect class="literal" x="698" y="20" width="24" height="25" rx="7"/><text class="text" x="708" y="37">,</text><a xlink:href="#operator-option"><rect class="rule" x="732" y="20" width="115" height="25"/><text class="text" x="742" y="37">operator_option</text></a><rect class="literal" x="897" y="20" width="25" height="25" rx="7"/><text class="text" x="907" y="37">)</text><polygon points="933,44 937,44 937,30 933,30" style="fill:black;stroke-width:0"/></svg> | ||
|
||
#### operator_option | ||
|
||
<svg class="rrdiagram" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="292" height="245" viewbox="0 0 292 245"><path class="connector" d="M0 22h35m74 0h10m30 0h10m73 0h45m-252 25q0 5 5 5h5m83 0h10m30 0h10m82 0h12q5 0 5-5m-242 30q0 5 5 5h5m105 0h10m30 0h10m67 0h5q5 0 5-5m-242 30q0 5 5 5h5m78 0h10m30 0h10m64 0h35q5 0 5-5m-242 30q0 5 5 5h5m79 0h10m30 0h10m71 0h27q5 0 5-5m-242 30q0 5 5 5h5m48 0h10m30 0h10m75 0h54q5 0 5-5m-242 30q0 5 5 5h5m70 0h157q5 0 5-5m-247-175q5 0 5 5v200q0 5 5 5h5m71 0h156q5 0 5-5v-200q0-5 5-5m5 0h15"/><polygon points="0,29 5,22 0,15" style="fill:black;stroke-width:0"/><rect class="literal" x="35" y="5" width="74" height="25" rx="7"/><text class="text" x="45" y="22">LEFTARG</text><rect class="literal" x="119" y="5" width="30" height="25" rx="7"/><text class="text" x="129" y="22">=</text><a xlink:href="../../syntax_resources/grammar_diagrams#left-type"><rect class="rule" x="159" y="5" width="73" height="25"/><text class="text" x="169" y="22">left_type</text></a><rect class="literal" x="35" y="35" width="83" height="25" rx="7"/><text class="text" x="45" y="52">RIGHTARG</text><rect class="literal" x="128" y="35" width="30" height="25" rx="7"/><text class="text" x="138" y="52">=</text><a xlink:href="../../syntax_resources/grammar_diagrams#right-type"><rect class="rule" x="168" y="35" width="82" height="25"/><text class="text" x="178" y="52">right_type</text></a><rect class="literal" x="35" y="65" width="105" height="25" rx="7"/><text class="text" x="45" y="82">COMMUTATOR</text><rect class="literal" x="150" y="65" width="30" height="25" rx="7"/><text class="text" x="160" y="82">=</text><a xlink:href="../../syntax_resources/grammar_diagrams#com-op"><rect class="rule" x="190" y="65" width="67" height="25"/><text class="text" x="200" y="82">com_op</text></a><rect class="literal" x="35" y="95" width="78" height="25" rx="7"/><text class="text" x="45" y="112">NEGATOR</text><rect class="literal" x="123" y="95" width="30" height="25" rx="7"/><text class="text" x="133" y="112">=</text><a xlink:href="../../syntax_resources/grammar_diagrams#neg-op"><rect class="rule" x="163" y="95" width="64" height="25"/><text class="text" x="173" y="112">neg_op</text></a><rect class="literal" x="35" y="125" width="79" height="25" rx="7"/><text class="text" x="45" y="142">RESTRICT</text><rect class="literal" x="124" y="125" width="30" height="25" rx="7"/><text class="text" x="134" y="142">=</text><a xlink:href="../../syntax_resources/grammar_diagrams#res-proc"><rect class="rule" x="164" y="125" width="71" height="25"/><text class="text" x="174" y="142">res_proc</text></a><rect class="literal" x="35" y="155" width="48" height="25" rx="7"/><text class="text" x="45" y="172">JOIN</text><rect class="literal" x="93" y="155" width="30" height="25" rx="7"/><text class="text" x="103" y="172">=</text><a xlink:href="../../syntax_resources/grammar_diagrams#join-proc"><rect class="rule" x="133" y="155" width="75" height="25"/><text class="text" x="143" y="172">join_proc</text></a><rect class="literal" x="35" y="185" width="70" height="25" rx="7"/><text class="text" x="45" y="202">HASHES</text><rect class="literal" x="35" y="215" width="71" height="25" rx="7"/><text class="text" x="45" y="232">MERGES</text><polygon points="288,29 292,29 292,15 288,15" style="fill:black;stroke-width:0"/></svg> | ||
|
15 changes: 15 additions & 0 deletions
15
...t/api/ysql/syntax_resources/commands/create_operator,operator_option.grammar.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
``` | ||
create_operator ::= CREATE OPERATOR operator_name ( | ||
{ FUNCTION = function_name | ||
| PROCEDURE = procedure_name } | ||
[ , operator_option [ ... ] ] ) | ||
operator_option ::= LEFTARG = left_type | ||
| RIGHTARG = right_type | ||
| COMMUTATOR = com_op | ||
| NEGATOR = neg_op | ||
| RESTRICT = res_proc | ||
| JOIN = join_proc | ||
| HASHES | ||
| MERGES | ||
``` |
2 changes: 1 addition & 1 deletion
2
...pi/ysql/syntax_resources/commands/drop_aggregate,aggregate_signature.diagram.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
...pi/ysql/syntax_resources/commands/drop_aggregate,aggregate_signature.grammar.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.