Beispiel #1
0
/*
 * Find the struct objaddr for an opclass or opfamily.
 */
static struct objaddr
get_objaddr_opcf(objtype_e objtype, struct list *objname, struct list *objargs)
{
	oid_t amoid;
	struct objaddr address;

	ASSERT(list_length(objargs) == 1);
	amoid = get_am_oid(str_value(linitial(objargs)), false);

	switch (objtype) {
	case OBJECT_OPCLASS:
		address.classId = OperatorClassRelationId;
		address.objectId = get_opclass_oid(amoid, objname, false);
		address.objectSubId = 0;
		break;

	case OBJECT_OPFAMILY:
		address.classId = OperatorFamilyRelationId;
		address.objectId = get_opfamily_oid(amoid, objname, false);
		address.objectSubId = 0;
		break;

	default:
		elog(ERROR, "unrecognized objtype: %d", (int) objtype);
		/* placate compiler, which doesn't know elog won't return */
		address.classId = INVALID_OID;
		address.objectId = INVALID_OID;
		address.objectSubId = 0;
	}

	return address;
}
Beispiel #2
0
/*
 * Find the ObjectAddress for an opclass or opfamily.
 */
static ObjectAddress
get_object_address_opcf(ObjectType objtype, List *objname, List *objargs)
{
	Oid			amoid;
	ObjectAddress address;

	Assert(list_length(objargs) == 1);
	amoid = get_am_oid(strVal(linitial(objargs)), false);

	switch (objtype)
	{
		case OBJECT_OPCLASS:
			address.classId = OperatorClassRelationId;
			address.objectId = get_opclass_oid(amoid, objname, false);
			address.objectSubId = 0;
			break;
		case OBJECT_OPFAMILY:
			address.classId = OperatorFamilyRelationId;
			address.objectId = get_opfamily_oid(amoid, objname, false);
			address.objectSubId = 0;
			break;
		default:
			elog(ERROR, "unrecognized objtype: %d", (int) objtype);
			/* placate compiler, which doesn't know elog won't return */
			address.classId = InvalidOid;
			address.objectId = InvalidOid;
			address.objectSubId = 0;
	}

	return address;
}