提交 5ae8d6d1 编写于 作者: H Heikki Linnakangas

Remove CaQL call from gphdfs.

Use the get_type_name() lsyscache function directly.
上级 0cd6c41e
......@@ -22,7 +22,6 @@
#include "funcapi.h"
#include "access/formatter.h"
#include "catalog/catquery.h"
#include "catalog/pg_proc.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
......@@ -254,28 +253,6 @@ static void byteArrayToBoolArray(bits8* data, int len, bool** booldata, int bool
}
}
/**
* Get the name of the type, given the OID
*/
static void getTypeName(Oid typeid, char* data)
{
char* name;
/* XXX: would have been get_type_name() */
name = caql_getcstring_plus(
NULL,
NULL,
NULL,
cql("SELECT typname FROM pg_type "
" WHERE oid = :1 ",
ObjectIdGetDatum(typeid)));
Insist(name);
strcpy(data, name);
pfree(name);
}
Datum
gphdfsformatter_export(PG_FUNCTION_ARGS)
{
......@@ -641,8 +618,11 @@ gphdfsformatter_import(PG_FUNCTION_ARGS)
if ((isBinaryFormatType(defined_type) || isBinaryFormatType(input_type)) &&
input_type != defined_type)
{
char intype[NAMEDATALEN];
getTypeName(input_type, intype);
char *intype;
intype = get_type_name(input_type);
Insist(intype);
ereport(ERROR, (errcode(ERRCODE_DATA_EXCEPTION),
errmsg("input data column %d of type \"%s\" did not match the external table definition",
i+1, intype),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册