Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
d0667af9
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,发现更多精彩内容 >>
提交
d0667af9
编写于
10月 23, 2001
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for INTERVAL's new typmod values to format_type.
上级
01b73d3f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
75 addition
and
4 deletion
+75
-4
src/backend/utils/adt/format_type.c
src/backend/utils/adt/format_type.c
+75
-4
未找到文件。
src/backend/utils/adt/format_type.c
浏览文件 @
d0667af9
...
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.
19 2001/10/08 19:55:07
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.
20 2001/10/23 20:12:54
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -20,12 +20,14 @@
#include "fmgr.h"
#include "catalog/pg_type.h"
#include "utils/builtins.h"
#include "utils/datetime.h"
#include "utils/numeric.h"
#include "utils/syscache.h"
#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
#endif
#define MASK(b) (1 << (b))
#define MAX_INT32_LEN 11
#define _textin(str) DirectFunctionCall1(textin, CStringGetDatum(str))
...
...
@@ -132,7 +134,8 @@ format_type_internal(Oid type_oid, int32 typemod, bool allow_invalid)
if
(
allow_invalid
)
return
pstrdup
(
"???"
);
else
elog
(
ERROR
,
"could not locate data type with oid %u in catalog"
,
type_oid
);
elog
(
ERROR
,
"could not locate data type with oid %u in catalog"
,
type_oid
);
}
array_base_type
=
((
Form_pg_type
)
GETSTRUCT
(
tuple
))
->
typelem
;
...
...
@@ -149,7 +152,8 @@ format_type_internal(Oid type_oid, int32 typemod, bool allow_invalid)
if
(
allow_invalid
)
return
pstrdup
(
"???[]"
);
else
elog
(
ERROR
,
"could not locate data type with oid %u in catalog"
,
type_oid
);
elog
(
ERROR
,
"could not locate data type with oid %u in catalog"
,
type_oid
);
}
is_array
=
true
;
type_oid
=
array_base_type
;
...
...
@@ -209,6 +213,73 @@ format_type_internal(Oid type_oid, int32 typemod, bool allow_invalid)
buf
=
pstrdup
(
"numeric"
);
break
;
case
INTERVALOID
:
if
(
with_typemod
)
{
int
fields
=
typemod
>>
16
;
int
precision
=
typemod
&
0xFFFF
;
const
char
*
fieldstr
;
switch
(
fields
)
{
case
MASK
(
YEAR
):
fieldstr
=
" year"
;
break
;
case
MASK
(
MONTH
):
fieldstr
=
" month"
;
break
;
case
MASK
(
DAY
):
fieldstr
=
" day"
;
break
;
case
MASK
(
HOUR
):
fieldstr
=
" hour"
;
break
;
case
MASK
(
MINUTE
):
fieldstr
=
" minute"
;
break
;
case
MASK
(
SECOND
):
fieldstr
=
" second"
;
break
;
case
MASK
(
YEAR
)
|
MASK
(
MONTH
):
fieldstr
=
" year to month"
;
break
;
case
MASK
(
DAY
)
|
MASK
(
HOUR
):
fieldstr
=
" day to hour"
;
break
;
case
MASK
(
DAY
)
|
MASK
(
HOUR
)
|
MASK
(
MINUTE
):
fieldstr
=
" day to minute"
;
break
;
case
MASK
(
DAY
)
|
MASK
(
HOUR
)
|
MASK
(
MINUTE
)
|
MASK
(
SECOND
):
fieldstr
=
" day to second"
;
break
;
case
MASK
(
HOUR
)
|
MASK
(
MINUTE
):
fieldstr
=
" hour to minute"
;
break
;
case
MASK
(
HOUR
)
|
MASK
(
MINUTE
)
|
MASK
(
SECOND
):
fieldstr
=
" hour to second"
;
break
;
case
MASK
(
MINUTE
)
|
MASK
(
SECOND
):
fieldstr
=
" minute to second"
;
break
;
case
0x7FFF
:
fieldstr
=
""
;
break
;
default:
elog
(
DEBUG
,
"Invalid INTERVAL typmod 0x%x"
,
typemod
);
fieldstr
=
""
;
break
;
}
if
(
precision
!=
0xFFFF
)
buf
=
psnprintf
(
100
,
"interval(%d)%s"
,
precision
,
fieldstr
);
else
buf
=
psnprintf
(
100
,
"interval%s"
,
fieldstr
);
}
else
buf
=
pstrdup
(
"interval"
);
break
;
case
TIMEOID
:
if
(
with_typemod
)
buf
=
psnprintf
(
50
,
"time(%d) without time zone"
,
...
...
@@ -300,7 +371,7 @@ format_type_internal(Oid type_oid, int32 typemod, bool allow_invalid)
int32
type_maximum_size
(
Oid
type_oid
,
int32
typemod
)
{
if
(
typemod
<
=
0
)
if
(
typemod
<
0
)
return
-
1
;
switch
(
type_oid
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录