Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
a5e6e993
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a5e6e993
编写于
8月 10, 2002
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow schema-qualified operator names to be used in the optional
arguments of CREATE OPERATOR.
上级
f1d82049
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
56 deletion
+55
-56
doc/src/sgml/ref/create_operator.sgml
doc/src/sgml/ref/create_operator.sgml
+10
-1
doc/src/sgml/syntax.sgml
doc/src/sgml/syntax.sgml
+13
-2
src/backend/commands/define.c
src/backend/commands/define.c
+14
-3
src/backend/parser/gram.y
src/backend/parser/gram.y
+18
-50
未找到文件。
doc/src/sgml/ref/create_operator.sgml
浏览文件 @
a5e6e993
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_operator.sgml,v 1.
29 2002/05/18 15:44:47 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_operator.sgml,v 1.
30 2002/08/10 19:01:53 tgl
Exp $
PostgreSQL documentation
-->
...
...
@@ -437,6 +437,15 @@ MYBOXES.description === box '((0,0), (1,1))'
Refer to <command>DROP OPERATOR</command> to delete
user-defined operators from a database.
</para>
<para>
To give a schema-qualified operator name in <replaceable
class="parameter">com_op</replaceable> or the other optional
arguments, use the <literal>OPERATOR()</> syntax, for example
<programlisting>
COMMUTATOR = OPERATOR(myschema.===) ,
</programlisting>
</para>
</refsect2>
</refsect1>
...
...
doc/src/sgml/syntax.sgml
浏览文件 @
a5e6e993
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.6
4 2002/08/05 19:43:31 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.6
5 2002/08/10 19:01:53 tgl
Exp $
-->
<chapter id="sql-syntax">
...
...
@@ -755,7 +755,7 @@ SELECT (5 !) - 6;
</row>
<row>
<entry><token>LIKE</token> <token>ILIKE</token></entry>
<entry><token>LIKE</token> <token>ILIKE</token>
<token>SIMILAR</token>
</entry>
<entry></entry>
<entry>string pattern matching</entry>
</row>
...
...
@@ -801,6 +801,17 @@ SELECT (5 !) - 6;
the same precedence as the built-in <quote>+</quote> operator, no
matter what yours does.
</para>
<para>
When a schema-qualified operator name is used in the
<literal>OPERATOR</> syntax, as for example in
<programlisting>
SELECT 3 OPERATOR(pg_catalog.+) 4;
</programlisting>
the <literal>OPERATOR</> construct is taken to have the default precedence
shown above for <quote>any other</> operator. This is true no matter
which specific operator name appears inside <literal>OPERATOR()</>.
</para>
</sect2>
</sect1>
...
...
src/backend/commands/define.c
浏览文件 @
a5e6e993
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.7
8 2002/06/20 20:29:27 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.7
9 2002/08/10 19:01:53 tgl
Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
...
...
@@ -35,6 +35,7 @@
#include <ctype.h>
#include <math.h>
#include "catalog/namespace.h"
#include "commands/defrem.h"
#include "parser/parse_type.h"
#include "utils/int8.h"
...
...
@@ -86,6 +87,8 @@ defGetString(DefElem *def)
return
strVal
(
def
->
arg
);
case
T_TypeName
:
return
TypeNameToString
((
TypeName
*
)
def
->
arg
);
case
T_List
:
return
NameListToString
((
List
*
)
def
->
arg
);
default:
elog
(
ERROR
,
"Define: cannot interpret argument of
\"
%s
\"
"
,
def
->
defname
);
...
...
@@ -156,6 +159,8 @@ defGetQualifiedName(DefElem *def)
{
case
T_TypeName
:
return
((
TypeName
*
)
def
->
arg
)
->
names
;
case
T_List
:
return
(
List
*
)
def
->
arg
;
case
T_String
:
/* Allow quoted name for backwards compatibility */
return
makeList1
(
def
->
arg
);
...
...
@@ -168,6 +173,9 @@ defGetQualifiedName(DefElem *def)
/*
* Extract a TypeName from a DefElem.
*
* Note: we do not accept a List arg here, because the parser will only
* return a bare List when the name looks like an operator name.
*/
TypeName
*
defGetTypeName
(
DefElem
*
def
)
...
...
@@ -223,11 +231,14 @@ defGetTypeLength(DefElem *def)
"variable"
)
==
0
)
return
-
1
;
/* variable length */
break
;
case
T_List
:
/* must be an operator name */
break
;
default:
elog
(
ERROR
,
"Define: cannot interpret argument of
\"
%s
\"
"
,
def
->
defname
);
}
elog
(
ERROR
,
"Define: invalid argument for
\"
%s
\"
"
,
def
->
defname
);
elog
(
ERROR
,
"Define: invalid argument for
\"
%s
\"
:
\"
%s
\"
"
,
def
->
defname
,
defGetString
(
def
)
);
return
0
;
/* keep compiler quiet */
}
src/backend/parser/gram.y
浏览文件 @
a5e6e993
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.35
7 2002/08/06 05:40:45 ishii
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.35
8 2002/08/10 19:01:53 tgl
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -1307,27 +1307,19 @@ copy_opt_list:
copy_opt_item:
BINARY
{
$$ = makeNode(DefElem);
$$->defname = "binary";
$$->arg = (Node *)makeInteger(TRUE);
$$ = makeDefElem("binary", (Node *)makeInteger(TRUE));
}
| OIDS
{
$$ = makeNode(DefElem);
$$->defname = "oids";
$$->arg = (Node *)makeInteger(TRUE);
$$ = makeDefElem("oids", (Node *)makeInteger(TRUE));
}
| DELIMITER opt_as Sconst
{
$$ = makeNode(DefElem);
$$->defname = "delimiter";
$$->arg = (Node *)makeString($3);
$$ = makeDefElem("delimiter", (Node *)makeString($3));
}
| NULL_P opt_as Sconst
{
$$ = makeNode(DefElem);
$$->defname = "null";
$$->arg = (Node *)makeString($3);
$$ = makeDefElem("null", (Node *)makeString($3));
}
;
...
...
@@ -1336,9 +1328,7 @@ copy_opt_item:
opt_binary:
BINARY
{
$$ = makeNode(DefElem);
$$->defname = "binary";
$$->arg = (Node *)makeInteger(TRUE);
$$ = makeDefElem("binary", (Node *)makeInteger(TRUE));
}
| /*EMPTY*/ { $$ = NULL; }
;
...
...
@@ -1346,9 +1336,7 @@ opt_binary:
opt_oids:
WITH OIDS
{
$$ = makeNode(DefElem);
$$->defname = "oids";
$$->arg = (Node *)makeInteger(TRUE);
$$ = makeDefElem("oids", (Node *)makeInteger(TRUE));
}
| /*EMPTY*/ { $$ = NULL; }
;
...
...
@@ -1357,9 +1345,7 @@ copy_delimiter:
/* USING DELIMITERS kept for backward compatibility. 2002-06-15 */
opt_using DELIMITERS Sconst
{
$$ = makeNode(DefElem);
$$->defname = "delimiter";
$$->arg = (Node *)makeString($3);
$$ = makeDefElem("delimiter", (Node *)makeString($3));
}
| /*EMPTY*/ { $$ = NULL; }
;
...
...
@@ -2276,7 +2262,7 @@ def_elem: ColLabel '=' def_arg
/* Note: any simple identifier will be returned as a type name! */
def_arg: func_return { $$ = (Node *)$1; }
|
all_Op { $$ = (Node *)makeString($1)
; }
|
qual_all_Op { $$ = (Node *)$1
; }
| NumericOnly { $$ = (Node *)$1; }
| Sconst { $$ = (Node *)makeString($1); }
;
...
...
@@ -3568,27 +3554,19 @@ createdb_opt_list:
createdb_opt_item:
LOCATION opt_equal Sconst
{
$$ = makeNode(DefElem);
$$->defname = "location";
$$->arg = (Node *)makeString($3);
$$ = makeDefElem("location", (Node *)makeString($3));
}
| LOCATION opt_equal DEFAULT
{
$$ = makeNode(DefElem);
$$->defname = "location";
$$->arg = NULL;
$$ = makeDefElem("location", NULL);
}
| TEMPLATE opt_equal name
{
$$ = makeNode(DefElem);
$$->defname = "template";
$$->arg = (Node *)makeString($3);
$$ = makeDefElem("template", (Node *)makeString($3));
}
| TEMPLATE opt_equal DEFAULT
{
$$ = makeNode(DefElem);
$$->defname = "template";
$$->arg = NULL;
$$ = makeDefElem("template", NULL);
}
| ENCODING opt_equal Sconst
{
...
...
@@ -3598,9 +3576,7 @@ createdb_opt_item:
elog(ERROR, "%s is not a valid encoding name", $3);
encoding = pg_char_to_encoding($3);
$$ = makeNode(DefElem);
$$->defname = "encoding";
$$->arg = (Node *)makeInteger(encoding);
$$ = makeDefElem("encoding", (Node *)makeInteger(encoding));
}
| ENCODING opt_equal Iconst
{
...
...
@@ -3610,27 +3586,19 @@ createdb_opt_item:
if (!strcmp(encoding_name,"") ||
pg_valid_server_encoding(encoding_name) < 0)
elog(ERROR, "%d is not a valid encoding code", $3);
$$ = makeNode(DefElem);
$$->defname = "encoding";
$$->arg = (Node *)makeInteger($3);
$$ = makeDefElem("encoding", (Node *)makeInteger($3));
}
| ENCODING opt_equal DEFAULT
{
$$ = makeNode(DefElem);
$$->defname = "encoding";
$$->arg = (Node *)makeInteger(-1);
$$ = makeDefElem("encoding", (Node *)makeInteger(-1));
}
| OWNER opt_equal name
{
$$ = makeNode(DefElem);
$$->defname = "owner";
$$->arg = (Node *)makeString($3);
$$ = makeDefElem("owner", (Node *)makeString($3));
}
| OWNER opt_equal DEFAULT
{
$$ = makeNode(DefElem);
$$->defname = "owner";
$$->arg = NULL;
$$ = makeDefElem("owner", NULL);
}
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录