Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
b0c1c53a
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,发现更多精彩内容 >>
提交
b0c1c53a
编写于
10月 24, 2000
作者:
P
Peter Eisentraut
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Integer binary operators, from Marko Kreen <marko@l-t.ee>. Renamed bitxor
operator to '#' for consistency. Parser still needs work.
上级
fa9357d0
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
297 addition
and
8 deletion
+297
-8
doc/src/sgml/oper.sgml
doc/src/sgml/oper.sgml
+31
-1
src/backend/utils/adt/int.c
src/backend/utils/adt/int.c
+119
-1
src/backend/utils/adt/int8.c
src/backend/utils/adt/int8.c
+63
-1
src/include/catalog/pg_operator.h
src/include/catalog/pg_operator.h
+23
-2
src/include/catalog/pg_proc.h
src/include/catalog/pg_proc.h
+39
-1
src/include/utils/builtins.h
src/include/utils/builtins.h
+14
-1
src/include/utils/int8.h
src/include/utils/int8.h
+8
-1
未找到文件。
doc/src/sgml/oper.sgml
浏览文件 @
b0c1c53a
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/oper.sgml,v 1.2
0 2000/10/04 15:47:45
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/oper.sgml,v 1.2
1 2000/10/24 20:13:31
petere Exp $
-->
<Chapter Id="operators">
...
...
@@ -493,6 +493,36 @@ logical union
<ENTRY>Cube root</ENTRY>
<ENTRY>||/ 27.0</ENTRY>
</ROW>
<ROW>
<ENTRY> & </ENTRY>
<ENTRY>Binary AND</ENTRY>
<ENTRY>91 & 15</ENTRY>
</ROW>
<ROW>
<ENTRY> | </ENTRY>
<ENTRY>Binary OR</ENTRY>
<ENTRY>32 | 3</ENTRY>
</ROW>
<ROW>
<ENTRY> # </ENTRY>
<ENTRY>Binary XOR</ENTRY>
<ENTRY>15 # 4</ENTRY>
</ROW>
<ROW>
<ENTRY> ~ </ENTRY>
<ENTRY>Binary NOT</ENTRY>
<ENTRY>~1</ENTRY>
</ROW>
<ROW>
<ENTRY> << </ENTRY>
<ENTRY>Binary shift left</ENTRY>
<ENTRY>1 << 4</ENTRY>
</ROW>
<ROW>
<ENTRY> >> </ENTRY>
<ENTRY>Binary shift right</ENTRY>
<ENTRY>8 >> 2</ENTRY>
</ROW>
</TBODY>
</TGROUP>
</TABLE>
...
...
src/backend/utils/adt/int.c
浏览文件 @
b0c1c53a
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.4
2 2000/08/01 18:29:35 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.4
3 2000/10/24 20:14:35 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -843,3 +843,121 @@ int4smaller(PG_FUNCTION_ARGS)
PG_RETURN_INT32
((
arg1
<
arg2
)
?
arg1
:
arg2
);
}
/* Binary arithmetics
*
* int[24]and - returns arg1 & arg2
* int[24]or - returns arg1 | arg2
* int[24]xor - returns arg1 # arg2
* int[24]not - returns ~arg1
* int[24]shl - returns arg1 << arg2
* int[24]shr - returns arg1 >> arg2
*/
Datum
int4and
(
PG_FUNCTION_ARGS
)
{
int32
arg1
=
PG_GETARG_INT32
(
0
);
int32
arg2
=
PG_GETARG_INT32
(
1
);
PG_RETURN_INT32
(
arg1
&
arg2
);
}
Datum
int4or
(
PG_FUNCTION_ARGS
)
{
int32
arg1
=
PG_GETARG_INT32
(
0
);
int32
arg2
=
PG_GETARG_INT32
(
1
);
PG_RETURN_INT32
(
arg1
|
arg2
);
}
Datum
int4xor
(
PG_FUNCTION_ARGS
)
{
int32
arg1
=
PG_GETARG_INT32
(
0
);
int32
arg2
=
PG_GETARG_INT32
(
1
);
PG_RETURN_INT32
(
arg1
^
arg2
);
}
Datum
int4shl
(
PG_FUNCTION_ARGS
)
{
int32
arg1
=
PG_GETARG_INT32
(
0
);
int32
arg2
=
PG_GETARG_INT32
(
1
);
PG_RETURN_INT32
(
arg1
<<
arg2
);
}
Datum
int4shr
(
PG_FUNCTION_ARGS
)
{
int32
arg1
=
PG_GETARG_INT32
(
0
);
int32
arg2
=
PG_GETARG_INT32
(
1
);
PG_RETURN_INT32
(
arg1
>>
arg2
);
}
Datum
int4not
(
PG_FUNCTION_ARGS
)
{
int32
arg1
=
PG_GETARG_INT32
(
0
);
PG_RETURN_INT32
(
~
arg1
);
}
Datum
int2and
(
PG_FUNCTION_ARGS
)
{
int16
arg1
=
PG_GETARG_INT16
(
0
);
int16
arg2
=
PG_GETARG_INT16
(
1
);
PG_RETURN_INT16
(
arg1
&
arg2
);
}
Datum
int2or
(
PG_FUNCTION_ARGS
)
{
int16
arg1
=
PG_GETARG_INT16
(
0
);
int16
arg2
=
PG_GETARG_INT16
(
1
);
PG_RETURN_INT16
(
arg1
|
arg2
);
}
Datum
int2xor
(
PG_FUNCTION_ARGS
)
{
int16
arg1
=
PG_GETARG_INT16
(
0
);
int16
arg2
=
PG_GETARG_INT16
(
1
);
PG_RETURN_INT16
(
arg1
^
arg2
);
}
Datum
int2not
(
PG_FUNCTION_ARGS
)
{
int16
arg1
=
PG_GETARG_INT16
(
0
);
PG_RETURN_INT16
(
~
arg1
);
}
Datum
int2shl
(
PG_FUNCTION_ARGS
)
{
int16
arg1
=
PG_GETARG_INT16
(
0
);
int32
arg2
=
PG_GETARG_INT32
(
1
);
PG_RETURN_INT16
(
arg1
<<
arg2
);
}
Datum
int2shr
(
PG_FUNCTION_ARGS
)
{
int16
arg1
=
PG_GETARG_INT16
(
0
);
int32
arg2
=
PG_GETARG_INT32
(
1
);
PG_RETURN_INT16
(
arg1
>>
arg2
);
}
src/backend/utils/adt/int8.c
浏览文件 @
b0c1c53a
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.2
4 2000/07/28 05:07:41 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.2
5 2000/10/24 20:14:35 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -591,6 +591,68 @@ int48div(PG_FUNCTION_ARGS)
PG_RETURN_INT64
(
val1
/
val2
);
}
/* Binary arithmetics
*
* int8and - returns arg1 & arg2
* int8or - returns arg1 | arg2
* int8xor - returns arg1 # arg2
* int8not - returns ~arg1
* int8shl - returns arg1 << arg2
* int8shr - returns arg1 >> arg2
*/
Datum
int8and
(
PG_FUNCTION_ARGS
)
{
int64
arg1
=
PG_GETARG_INT64
(
0
);
int64
arg2
=
PG_GETARG_INT64
(
1
);
PG_RETURN_INT64
(
arg1
&
arg2
);
}
Datum
int8or
(
PG_FUNCTION_ARGS
)
{
int64
arg1
=
PG_GETARG_INT64
(
0
);
int64
arg2
=
PG_GETARG_INT64
(
1
);
PG_RETURN_INT64
(
arg1
|
arg2
);
}
Datum
int8xor
(
PG_FUNCTION_ARGS
)
{
int64
arg1
=
PG_GETARG_INT64
(
0
);
int64
arg2
=
PG_GETARG_INT64
(
1
);
PG_RETURN_INT64
(
arg1
^
arg2
);
}
Datum
int8not
(
PG_FUNCTION_ARGS
)
{
int64
arg1
=
PG_GETARG_INT64
(
0
);
PG_RETURN_INT64
(
~
arg1
);
}
Datum
int8shl
(
PG_FUNCTION_ARGS
)
{
int64
arg1
=
PG_GETARG_INT64
(
0
);
int32
arg2
=
PG_GETARG_INT32
(
1
);
PG_RETURN_INT64
(
arg1
<<
arg2
);
}
Datum
int8shr
(
PG_FUNCTION_ARGS
)
{
int64
arg1
=
PG_GETARG_INT64
(
0
);
int32
arg2
=
PG_GETARG_INT32
(
1
);
PG_RETURN_INT64
(
arg1
>>
arg2
);
}
/*----------------------------------------------------------
* Conversion operators.
...
...
src/include/catalog/pg_operator.h
浏览文件 @
b0c1c53a
...
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_operator.h,v 1.8
2 2000/09/15 18:45:27 tgl
Exp $
* $Id: pg_operator.h,v 1.8
3 2000/10/24 20:15:45 petere
Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
...
...
@@ -727,7 +727,7 @@ DATA(insert OID = 1788 ( "<=" PGUID 0 b t f 1560 1560 16 1789 1787 0 0 bitle
DATA
(
insert
OID
=
1789
(
">="
PGUID
0
b
t
f
1560
1560
16
1788
1786
0
0
bitge
scalargtsel
scalargtjoinsel
));
DATA
(
insert
OID
=
1791
(
"&"
PGUID
0
b
t
f
1560
1560
1560
1791
0
0
0
bitand
-
-
));
DATA
(
insert
OID
=
1792
(
"|"
PGUID
0
b
t
f
1560
1560
1560
1792
0
0
0
bitor
-
-
));
DATA
(
insert
OID
=
1793
(
"
^
"
PGUID
0
b
t
f
1560
1560
1560
1793
0
0
0
bitxor
-
-
));
DATA
(
insert
OID
=
1793
(
"
#
"
PGUID
0
b
t
f
1560
1560
1560
1793
0
0
0
bitxor
-
-
));
DATA
(
insert
OID
=
1794
(
"~"
PGUID
0
l
t
f
0
1560
1560
0
0
0
0
bitnot
-
-
));
DATA
(
insert
OID
=
1795
(
"<<"
PGUID
0
b
t
f
1560
23
1560
0
0
0
0
bitshiftleft
-
-
));
DATA
(
insert
OID
=
1796
(
">>"
PGUID
0
b
t
f
1560
23
1560
0
0
0
0
bitshiftright
-
-
));
...
...
@@ -754,6 +754,27 @@ DATA(insert OID = 1871 ( ">" PGUID 0 b t f 20 21 16 1864 1872 0 0 int8
DATA
(
insert
OID
=
1872
(
"<="
PGUID
0
b
t
f
20
21
16
1867
1871
0
0
int82le
scalarltsel
scalarltjoinsel
));
DATA
(
insert
OID
=
1873
(
">="
PGUID
0
b
t
f
20
21
16
1866
1870
0
0
int82ge
scalargtsel
scalargtjoinsel
));
DATA
(
insert
OID
=
1874
(
"&"
PGUID
0
b
t
f
21
21
21
1874
0
0
0
int2and
-
-
));
DATA
(
insert
OID
=
1875
(
"|"
PGUID
0
b
t
f
21
21
21
1875
0
0
0
int2or
-
-
));
DATA
(
insert
OID
=
1876
(
"#"
PGUID
0
b
t
f
21
21
21
1876
0
0
0
int2xor
-
-
));
DATA
(
insert
OID
=
1877
(
"~"
PGUID
0
l
t
f
0
21
21
0
0
0
0
int2not
-
-
));
DATA
(
insert
OID
=
1878
(
"<<"
PGUID
0
b
t
f
21
23
21
0
0
0
0
int2shl
-
-
));
DATA
(
insert
OID
=
1879
(
">>"
PGUID
0
b
t
f
21
23
21
0
0
0
0
int2shr
-
-
));
DATA
(
insert
OID
=
1880
(
"&"
PGUID
0
b
t
f
23
23
23
1880
0
0
0
int4and
-
-
));
DATA
(
insert
OID
=
1881
(
"|"
PGUID
0
b
t
f
23
23
23
1881
0
0
0
int4or
-
-
));
DATA
(
insert
OID
=
1882
(
"#"
PGUID
0
b
t
f
23
23
23
1882
0
0
0
int4xor
-
-
));
DATA
(
insert
OID
=
1883
(
"~"
PGUID
0
l
t
f
0
23
23
0
0
0
0
int4not
-
-
));
DATA
(
insert
OID
=
1884
(
"<<"
PGUID
0
b
t
f
23
23
23
0
0
0
0
int4shl
-
-
));
DATA
(
insert
OID
=
1885
(
">>"
PGUID
0
b
t
f
23
23
23
0
0
0
0
int4shr
-
-
));
DATA
(
insert
OID
=
1886
(
"&"
PGUID
0
b
t
f
20
20
20
1886
0
0
0
int8and
-
-
));
DATA
(
insert
OID
=
1887
(
"|"
PGUID
0
b
t
f
20
20
20
1887
0
0
0
int8or
-
-
));
DATA
(
insert
OID
=
1888
(
"#"
PGUID
0
b
t
f
20
20
20
1888
0
0
0
int8xor
-
-
));
DATA
(
insert
OID
=
1889
(
"~"
PGUID
0
l
t
f
0
20
20
0
0
0
0
int8not
-
-
));
DATA
(
insert
OID
=
1890
(
"<<"
PGUID
0
b
t
f
20
23
20
0
0
0
0
int8shl
-
-
));
DATA
(
insert
OID
=
1891
(
">>"
PGUID
0
b
t
f
20
23
20
0
0
0
0
int8shr
-
-
));
/*
* function prototypes
*/
...
...
src/include/catalog/pg_proc.h
浏览文件 @
b0c1c53a
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_proc.h,v 1.1
69 2000/10/11 15:31:13 pjw
Exp $
* $Id: pg_proc.h,v 1.1
70 2000/10/24 20:15:45 petere
Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
...
...
@@ -2513,6 +2513,44 @@ DESCR("less-than-or-equal");
DATA
(
insert
OID
=
1861
(
int82ge
PGUID
12
f
t
t
t
2
f
16
"20 21"
100
0
0
100
int82ge
-
));
DESCR
(
"greater-than-or-equal"
);
DATA
(
insert
OID
=
1892
(
int2and
PGUID
12
f
t
t
t
2
f
21
"21 21"
100
0
0
100
int2and
-
));
DESCR
(
"binary and"
);
DATA
(
insert
OID
=
1893
(
int2or
PGUID
12
f
t
t
t
2
f
21
"21 21"
100
0
0
100
int2or
-
));
DESCR
(
"binary or"
);
DATA
(
insert
OID
=
1894
(
int2xor
PGUID
12
f
t
t
t
2
f
21
"21 21"
100
0
0
100
int2xor
-
));
DESCR
(
"binary xor"
);
DATA
(
insert
OID
=
1895
(
int2not
PGUID
12
f
t
t
t
1
f
21
"21"
100
0
0
100
int2not
-
));
DESCR
(
"binary not"
);
DATA
(
insert
OID
=
1896
(
int2shl
PGUID
12
f
t
t
t
2
f
21
"21 23"
100
0
0
100
int2shl
-
));
DESCR
(
"binary shift left"
);
DATA
(
insert
OID
=
1897
(
int2shr
PGUID
12
f
t
t
t
2
f
21
"21 23"
100
0
0
100
int2shr
-
));
DESCR
(
"binary shift right"
);
DATA
(
insert
OID
=
1898
(
int4and
PGUID
12
f
t
t
t
2
f
23
"23 23"
100
0
0
100
int4and
-
));
DESCR
(
"binary and"
);
DATA
(
insert
OID
=
1899
(
int4or
PGUID
12
f
t
t
t
2
f
23
"23 23"
100
0
0
100
int4or
-
));
DESCR
(
"binary or"
);
DATA
(
insert
OID
=
1900
(
int4xor
PGUID
12
f
t
t
t
2
f
23
"23 23"
100
0
0
100
int4xor
-
));
DESCR
(
"binary xor"
);
DATA
(
insert
OID
=
1901
(
int4not
PGUID
12
f
t
t
t
1
f
23
"23"
100
0
0
100
int4not
-
));
DESCR
(
"binary not"
);
DATA
(
insert
OID
=
1902
(
int4shl
PGUID
12
f
t
t
t
2
f
23
"23 23"
100
0
0
100
int4shl
-
));
DESCR
(
"binary shift left"
);
DATA
(
insert
OID
=
1903
(
int4shr
PGUID
12
f
t
t
t
2
f
23
"23 23"
100
0
0
100
int4shr
-
));
DESCR
(
"binary shift right"
);
DATA
(
insert
OID
=
1904
(
int8and
PGUID
12
f
t
t
t
2
f
20
"20 20"
100
0
0
100
int8and
-
));
DESCR
(
"binary and"
);
DATA
(
insert
OID
=
1905
(
int8or
PGUID
12
f
t
t
t
2
f
20
"20 20"
100
0
0
100
int8or
-
));
DESCR
(
"binary or"
);
DATA
(
insert
OID
=
1906
(
int8xor
PGUID
12
f
t
t
t
2
f
20
"20 20"
100
0
0
100
int8xor
-
));
DESCR
(
"binary xor"
);
DATA
(
insert
OID
=
1907
(
int8not
PGUID
12
f
t
t
t
1
f
20
"20"
100
0
0
100
int8not
-
));
DESCR
(
"binary not"
);
DATA
(
insert
OID
=
1908
(
int8shl
PGUID
12
f
t
t
t
2
f
20
"20 23"
100
0
0
100
int8shl
-
));
DESCR
(
"binary shift left"
);
DATA
(
insert
OID
=
1909
(
int8shr
PGUID
12
f
t
t
t
2
f
20
"20 23"
100
0
0
100
int8shr
-
));
DESCR
(
"binary shift right"
);
/*
* prototypes for functions pg_proc.c
...
...
src/include/utils/builtins.h
浏览文件 @
b0c1c53a
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: builtins.h,v 1.1
39 2000/09/25 16:36:36 tgl
Exp $
* $Id: builtins.h,v 1.1
40 2000/10/24 20:16:47 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -127,6 +127,19 @@ extern Datum int2smaller(PG_FUNCTION_ARGS);
extern
Datum
int4larger
(
PG_FUNCTION_ARGS
);
extern
Datum
int4smaller
(
PG_FUNCTION_ARGS
);
extern
Datum
int4and
(
PG_FUNCTION_ARGS
);
extern
Datum
int4or
(
PG_FUNCTION_ARGS
);
extern
Datum
int4xor
(
PG_FUNCTION_ARGS
);
extern
Datum
int4not
(
PG_FUNCTION_ARGS
);
extern
Datum
int4shl
(
PG_FUNCTION_ARGS
);
extern
Datum
int4shr
(
PG_FUNCTION_ARGS
);
extern
Datum
int2and
(
PG_FUNCTION_ARGS
);
extern
Datum
int2or
(
PG_FUNCTION_ARGS
);
extern
Datum
int2xor
(
PG_FUNCTION_ARGS
);
extern
Datum
int2not
(
PG_FUNCTION_ARGS
);
extern
Datum
int2shl
(
PG_FUNCTION_ARGS
);
extern
Datum
int2shr
(
PG_FUNCTION_ARGS
);
/* name.c */
extern
Datum
namein
(
PG_FUNCTION_ARGS
);
extern
Datum
nameout
(
PG_FUNCTION_ARGS
);
...
...
src/include/utils/int8.h
浏览文件 @
b0c1c53a
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: int8.h,v 1.2
3 2000/07/28 05:07:44 tgl
Exp $
* $Id: int8.h,v 1.2
4 2000/10/24 20:16:48 petere
Exp $
*
* NOTES
* These data types are supported on all 64-bit architectures, and may
...
...
@@ -76,6 +76,13 @@ extern Datum int8mod(PG_FUNCTION_ARGS);
extern
Datum
int8larger
(
PG_FUNCTION_ARGS
);
extern
Datum
int8smaller
(
PG_FUNCTION_ARGS
);
extern
Datum
int8and
(
PG_FUNCTION_ARGS
);
extern
Datum
int8or
(
PG_FUNCTION_ARGS
);
extern
Datum
int8xor
(
PG_FUNCTION_ARGS
);
extern
Datum
int8not
(
PG_FUNCTION_ARGS
);
extern
Datum
int8shl
(
PG_FUNCTION_ARGS
);
extern
Datum
int8shr
(
PG_FUNCTION_ARGS
);
extern
Datum
int84pl
(
PG_FUNCTION_ARGS
);
extern
Datum
int84mi
(
PG_FUNCTION_ARGS
);
extern
Datum
int84mul
(
PG_FUNCTION_ARGS
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录