ReleaseSysCache(tuple);
+ if (!ret)
+ return false;
+
/* For polymorphic opcintype, column type changes break compatibility. */
irel = index_open(oldId, AccessShareLock); /* caller probably has a lock */
- for (i = 0; i < old_natts && ret; i++)
- ret = (!IsPolymorphicType(get_opclass_input_type(classObjectId[i])) ||
- irel->rd_att->attrs[i]->atttypid == typeObjectId[i]);
+ for (i = 0; i < old_natts; i++)
+ {
+ if (IsPolymorphicType(get_opclass_input_type(classObjectId[i])) &&
+ irel->rd_att->attrs[i]->atttypid != typeObjectId[i])
+ {
+ ret = false;
+ break;
+ }
+ }
/* Any change in exclusion operator selections breaks compatibility. */
if (ret && indexInfo->ii_ExclusionOps != NULL)
old_natts * sizeof(Oid)) == 0;
/* Require an exact input type match for polymorphic operators. */
- for (i = 0; i < old_natts && ret; i++)
+ if (ret)
{
- Oid left,
- right;
+ for (i = 0; i < old_natts && ret; i++)
+ {
+ Oid left,
+ right;
- op_input_types(indexInfo->ii_ExclusionOps[i], &left, &right);
- ret = (!(IsPolymorphicType(left) || IsPolymorphicType(right)) ||
- irel->rd_att->attrs[i]->atttypid == typeObjectId[i]);
+ op_input_types(indexInfo->ii_ExclusionOps[i], &left, &right);
+ if ((IsPolymorphicType(left) || IsPolymorphicType(right)) &&
+ irel->rd_att->attrs[i]->atttypid != typeObjectId[i])
+ {
+ ret = false;
+ break;
+ }
+ }
}
}
t
(1 row)
--- SET DATA TYPE without a rewrite
-CREATE DOMAIN other_textarr AS text[];
-CREATE TABLE norewrite_array(c text[] PRIMARY KEY);
-NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "norewrite_array_pkey" for table "norewrite_array"
-SET client_min_messages = debug1;
-ALTER TABLE norewrite_array ALTER c TYPE text[]; -- no work
-ALTER TABLE norewrite_array ALTER c TYPE other_textarr; -- rebuild index
-DEBUG: building index "norewrite_array_pkey" on table "norewrite_array"
-RESET client_min_messages;
--
-- lock levels
--
from pg_class
where oid = 'test_storage'::regclass;
--- SET DATA TYPE without a rewrite
-CREATE DOMAIN other_textarr AS text[];
-CREATE TABLE norewrite_array(c text[] PRIMARY KEY);
-SET client_min_messages = debug1;
-ALTER TABLE norewrite_array ALTER c TYPE text[]; -- no work
-ALTER TABLE norewrite_array ALTER c TYPE other_textarr; -- rebuild index
-RESET client_min_messages;
-
--
-- lock levels
--