Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
6ef8d1cc
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,发现更多精彩内容 >>
提交
6ef8d1cc
编写于
4月 29, 2020
作者:
A
Adam Lee
提交者:
Adam Lee
5月 19, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gpcloud: fix compiling issue due to pg_exttable removal
上级
e4b499aa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
19 deletion
+17
-19
gpcontrib/gpcloud/src/gpcloud.cpp
gpcontrib/gpcloud/src/gpcloud.cpp
+17
-19
未找到文件。
gpcontrib/gpcloud/src/gpcloud.cpp
浏览文件 @
6ef8d1cc
...
...
@@ -15,6 +15,7 @@ extern "C" {
#include "access/xact.h"
#include "catalog/pg_exttable.h"
#include "catalog/pg_proc.h"
#include "commands/defrem.h"
#include "fmgr.h"
#include "funcapi.h"
#include "utils/array.h"
...
...
@@ -128,44 +129,41 @@ static void parseFormatOpts(FunctionCallInfo fcinfo) {
ExtTableEntry
*
exttbl
=
GetExtTableEntry
(
rel
->
rd_id
);
const
char
fmtcode
=
exttbl
->
fmtcode
;
const
char
*
fmtopts
=
exttbl
->
fmtopts
;
const
List
*
fmtopts
=
exttbl
->
options
;
char
*
newline_str
=
NULL
;
// only TEXT and CSV have detailed options
if
(
fmttype_is_csv
(
fmtcode
)
||
fmttype_is_text
(
fmtcode
))
{
if
(
strstr
(
fmtopts
,
"header"
)
!=
NULL
)
{
hasHeader
=
true
;
}
else
{
hasHeader
=
false
;
ListCell
*
option
;
foreach
(
option
,
fmtopts
)
{
DefElem
*
defel
=
(
DefElem
*
)
lfirst
(
option
);
if
(
strcmp
(
defel
->
defname
,
"header"
)
==
0
)
{
hasHeader
=
defGetBoolean
(
defel
);
}
else
if
(
strcmp
(
defel
->
defname
,
"newline"
)
==
0
)
{
newline_str
=
defGetString
(
defel
);
}
}
// detect end-of-line terminator
const
char
*
newline_str
=
strstr
(
fmtopts
,
"newline"
);
// default end-of-line terminator
eolString
[
0
]
=
'\n'
;
eolString
[
1
]
=
'\0'
;
if
(
newline_str
!=
NULL
)
{
const
char
*
first
=
strchr
(
newline_str
,
'\''
);
const
char
*
second
=
strchr
(
first
+
1
,
'\''
);
size_t
len
=
second
-
first
-
1
;
char
newline
[
EOL_STRING_MAX_LEN
+
1
];
len
=
len
>
EOL_STRING_MAX_LEN
?
EOL_STRING_MAX_LEN
:
len
;
// defensive line
strncpy
(
newline
,
first
+
1
,
len
);
newline
[
len
]
=
'\0'
;
if
(
pg_strcasecmp
(
newline
,
"crlf"
)
==
0
)
{
if
(
pg_strcasecmp
(
newline_str
,
"crlf"
)
==
0
)
{
eolString
[
0
]
=
'\r'
;
eolString
[
1
]
=
'\n'
;
eolString
[
2
]
=
'\0'
;
}
else
if
(
pg_strcasecmp
(
newline
,
"cr"
)
==
0
)
{
}
else
if
(
pg_strcasecmp
(
newline
_str
,
"cr"
)
==
0
)
{
eolString
[
0
]
=
'\r'
;
eolString
[
1
]
=
'\0'
;
}
else
if
(
pg_strcasecmp
(
newline
,
"lf"
)
==
0
)
{
}
else
if
(
pg_strcasecmp
(
newline
_str
,
"lf"
)
==
0
)
{
eolString
[
0
]
=
'\n'
;
eolString
[
1
]
=
'\0'
;
}
else
{
// should never come here
ereport
(
ERROR
,
(
0
,
errmsg
(
"invalid value for NEWLINE (%s), "
"valid options are: 'LF', 'CRLF', 'CR'"
,
newline
)));
newline
_str
)));
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录