Re: SQL:2011 application time

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL:2011 application time
Date: 2024-03-26 00:00:00
Message-ID: CACJufxHOO6fS_VZHV3On7P8ZwDcQfbB4Fbc9cgUpr3pd2hpiHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 24, 2024 at 1:42 AM Paul Jungwirth
<pj(at)illuminatedcomputing(dot)com> wrote:
>
> v33 attached with minor changes.
>
> Okay, added those tests too. Thanks!
>
> Rebased to 697f8d266c.
>

hi.
minor issues I found in v33-0003.
there are 29 of {check_amproc_signature?.*false}
only one {check_amproc_signature(procform->amproc, opcintype, true}
is this refactoring really worth it?

We also need to refactor gistadjustmembers?

+ <row>
+ <entry><function>intersect</function></entry>
+ <entry>computes intersection with <literal>FOR PORTION OF</literal>
+ bounds</entry>
+ <entry>13</entry>
+ </row>
+ <row>
+ <entry><function>without_portion</function></entry>
+ <entry>computes remaining duration(s) outside
+ <literal>FOR PORTION OF</literal> bounds</entry>
+ <entry>14</entry>
+ </row>
needs to add "(optional)".

+<programlisting>
+Datum
+my_range_intersect(PG_FUNCTION_ARGS)
+{
+ RangeType *r1 = PG_GETARG_RANGE_P(0);
+ RangeType *r2 = PG_GETARG_RANGE_P(1);
+ TypeCacheEntry *typcache;
+
+ /* Different types should be prevented by ANYRANGE matching rules */
+ if (RangeTypeGetOid(r1) != RangeTypeGetOid(r2))
elog(ERROR, "range
types do not match");
+
+ typcache = range_get_typcache(fcinfo, RangeTypeGetOid(r1));
+
+ PG_RETURN_RANGE_P(range_intersect_internal(typcache, r1, r2));
+}
+</programlisting>
the elog, ERROR indentation is wrong?

+/*
+ * range_without_portion_internal - Sets outputs and outputn to the ranges
+ * remaining and their count (respectively) after subtracting r2 from r1.
+ * The array should never contain empty ranges.
+ * The outputs will be ordered. We expect that outputs is an array of
+ * RangeType pointers, already allocated with two slots.
+ */
+void
+range_without_portion_internal(TypeCacheEntry *typcache, RangeType *r1,
+ RangeType *r2, RangeType **outputs, int *outputn)
the comments need to be refactored?
there is nothing related to "slot"?
not sure the "array" description is right.
(my understanding is compute rangetype r1 and r2, and save the result to
RangeType **outputs.

select proisstrict, proname from pg_proc where proname =
'range_without_portion';
range_without_portion is strict.
but
select range_without_portion(NULL::int4range, int4range(11, 20,'[]'));
return zero rows.
Is this the expected behavior?

0003 seems simple enough.
but it's more related to "for portion of".
not sure we can push 0003 into v17.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-03-26 00:14:47 Re: Regression tests fail with musl libc because libpq.so can't be loaded
Previous Message Thomas Munro 2024-03-25 23:49:55 Re: Regression tests fail with musl libc because libpq.so can't be loaded