On 20.03.24 17:21, Paul Jungwirth wrote:
> On 3/20/24 03:55, jian he wrote:
>> hi.
>> minor cosmetic issues, other than that, looks good.
>>
>> *pk_period = (indexStruct->indisexclusion);
>> to
>> *pk_period = indexStruct->indisexclusion;
>>
>> ... >
>> if (with_period && !fkconstraint->fk_with_period)
>> ereport(ERROR,
>> (errcode(ERRCODE_INVALID_FOREIGN_KEY),
>> errmsg("foreign key uses PERIOD on the referenced table but not the
>> referencing table")));
>
> Both included in the new patches here.
>
> Rebased to a0390f6ca6.
Two more questions:
1. In ri_triggers.c ri_KeysEqual, you swap the order of arguments to
ri_AttributesEqual():
- if (!ri_AttributesEqual(riinfo->ff_eq_oprs[i],
RIAttType(rel, attnums[i]),
- oldvalue, newvalue))
+ if (!ri_AttributesEqual(eq_opr, RIAttType(rel, attnums[i]),
+ newvalue, oldvalue))
But the declared arguments of ri_AttributesEqual() are oldvalue and
newvalue, so passing them backwards is really confusing. And the change
does matter in the tests.
Can we organize this better?
2. There are some tests that error with
ERROR: only b-tree indexes are supported for non-PERIOD foreign keys
But this is an elog() error, so should not normally be visible. I
suspect some other error should really show here, and the order of
checks is a bit wrong or something?