35 char *conversion_name;
40 const char *from_encoding_name =
stmt->for_encoding_name;
41 const char *to_encoding_name =
stmt->to_encoding_name;
43 static const Oid funcargs[] = {INT4OID, INT4OID, CSTRINGOID, INTERNALOID, INT4OID, BOOLOID};
59 if (from_encoding < 0)
61 (
errcode(ERRCODE_UNDEFINED_OBJECT),
62 errmsg(
"source encoding \"%s\" does not exist",
63 from_encoding_name)));
68 (
errcode(ERRCODE_UNDEFINED_OBJECT),
69 errmsg(
"destination encoding \"%s\" does not exist",
81 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
82 errmsg(
"encoding conversion to or from \"SQL_ASCII\" is not supported")));
94 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
95 errmsg(
"encoding conversion function %s must return type %s",
124 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
125 errmsg(
"encoding conversion function %s returned incorrect result for empty input",
133 from_encoding, to_encoding, funcoid,
stmt->def);
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
ObjectAddress CreateConversionCommand(CreateConversionStmt *stmt)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define OidFunctionCall6(functionId, arg1, arg2, arg3, arg4, arg5, arg6)
char * get_namespace_name(Oid nspid)
Oid get_func_rettype(Oid funcid)
Oid QualifiedNameGetCreationNamespace(const List *names, char **objname_p)
char * NameListToString(const List *names)
Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes, bool missing_ok)
ObjectAddress ConversionCreate(const char *conname, Oid connamespace, Oid conowner, int32 conforencoding, int32 contoencoding, Oid conproc, bool def)
#define pg_char_to_encoding
static Datum BoolGetDatum(bool X)
static Datum CStringGetDatum(const char *X)
static Datum Int32GetDatum(int32 X)
static int32 DatumGetInt32(Datum X)