Re: SQL:2011 application time

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL:2011 application time
Date: 2024-03-21 14:57:20
Message-ID: 85dd3ad0-fa79-46e8-a08b-c426c76825f3@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-03-21 15:20:32 Re: An improved README experience for PostgreSQL
Previous Message Tomas Vondra 2024-03-21 14:55:14 Re: BitmapHeapScan streaming read user and prelim refactoring