Commit 83ab8e32 authored by Alvaro Herrera's avatar Alvaro Herrera

Fix object identities for text search objects

We were neglecting to schema-qualify them.

Backpatch to 9.3, where object identities were introduced as a concept
by commit f8348ea3.
parent 5b68d816
......@@ -3078,6 +3078,7 @@ getObjectIdentity(const ObjectAddress *object)
{
HeapTuple tup;
Form_pg_ts_parser formParser;
char *schema;
tup = SearchSysCache1(TSPARSEROID,
ObjectIdGetDatum(object->objectId));
......@@ -3085,8 +3086,10 @@ getObjectIdentity(const ObjectAddress *object)
elog(ERROR, "cache lookup failed for text search parser %u",
object->objectId);
formParser = (Form_pg_ts_parser) GETSTRUCT(tup);
schema = get_namespace_name(formParser->prsnamespace);
appendStringInfoString(&buffer,
quote_identifier(NameStr(formParser->prsname)));
quote_qualified_identifier(schema,
NameStr(formParser->prsname)));
ReleaseSysCache(tup);
break;
}
......@@ -3095,6 +3098,7 @@ getObjectIdentity(const ObjectAddress *object)
{
HeapTuple tup;
Form_pg_ts_dict formDict;
char *schema;
tup = SearchSysCache1(TSDICTOID,
ObjectIdGetDatum(object->objectId));
......@@ -3102,8 +3106,10 @@ getObjectIdentity(const ObjectAddress *object)
elog(ERROR, "cache lookup failed for text search dictionary %u",
object->objectId);
formDict = (Form_pg_ts_dict) GETSTRUCT(tup);
schema = get_namespace_name(formDict->dictnamespace);
appendStringInfoString(&buffer,
quote_identifier(NameStr(formDict->dictname)));
quote_qualified_identifier(schema,
NameStr(formDict->dictname)));
ReleaseSysCache(tup);
break;
}
......@@ -3112,6 +3118,7 @@ getObjectIdentity(const ObjectAddress *object)
{
HeapTuple tup;
Form_pg_ts_template formTmpl;
char *schema;
tup = SearchSysCache1(TSTEMPLATEOID,
ObjectIdGetDatum(object->objectId));
......@@ -3119,8 +3126,11 @@ getObjectIdentity(const ObjectAddress *object)
elog(ERROR, "cache lookup failed for text search template %u",
object->objectId);
formTmpl = (Form_pg_ts_template) GETSTRUCT(tup);
schema = get_namespace_name(formTmpl->tmplnamespace);
appendStringInfoString(&buffer,
quote_identifier(NameStr(formTmpl->tmplname)));
quote_qualified_identifier(schema,
NameStr(formTmpl->tmplname)));
pfree(schema);
ReleaseSysCache(tup);
break;
}
......@@ -3129,6 +3139,7 @@ getObjectIdentity(const ObjectAddress *object)
{
HeapTuple tup;
Form_pg_ts_config formCfg;
char *schema;
tup = SearchSysCache1(TSCONFIGOID,
ObjectIdGetDatum(object->objectId));
......@@ -3136,8 +3147,10 @@ getObjectIdentity(const ObjectAddress *object)
elog(ERROR, "cache lookup failed for text search configuration %u",
object->objectId);
formCfg = (Form_pg_ts_config) GETSTRUCT(tup);
schema = get_namespace_name(formCfg->cfgnamespace);
appendStringInfoString(&buffer,
quote_identifier(NameStr(formCfg->cfgname)));
quote_qualified_identifier(schema,
NameStr(formCfg->cfgname)));
ReleaseSysCache(tup);
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment