You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several of my tasks require passing additional options to `df.http` and
`df.http_multipart`. Unfortunately, adding new parameters to these
functions is Hard. The normal approach (for example taken in #377 with
the `df.loop`) is to keep the old function around, renamed (but with the
same wrapper name). This is fine (and even avoids issues when
`ALTER EXTENSION UPDATE` is not run), but `df.http` and
`df.http_multipart` are functions that will likely have a bunch
of `GRANT`s (and those grants are semantically meaningful to
`pg_durable` beyond our ability to call the functions).
If we try to capture and re-issue[^1] those grants from an extension, PG
will record the grants as coming from the extension update script, and
assume it doesn't need to provide them in pg_dump, so then the
pg_restore won't have them, meaning logical restore and/or PG upgrades
will be broken.
The AI suggested the right approach was some catalog feng shui but that
it would take a while to engineer. I asked on the PostgreSQL discord,
and one of the PG committers (rhass) told me that this (trying to copy
grants from one function to another) was something that you should
never do, and to just have users reissue the grants on update.
So... instead of that, we just add a combinator function that
manipulates the durofut JSON directly to add the options. For
example, you'd use it like:
```sql
df.with_http_options(
df.http(...),
'{"options": "here"}'::jsonb
);
```
This admittedly is less ergonomic than adding an `options =>` parameter
for `df.http`, but... well, yeah.
If we want, we could make this into an operator, e.g. allowing
`df.http(...) <some-operator> '{"options": "here"}'` or something like
that? I don't have strong feelings.
[^1]: This is ignoring the fact that the permissions may be different
now, for example even ignoring the next issue this won't work quite
right if a delegator of a grant became a superuser.
Copy file name to clipboardExpand all lines: docs/upgrade-testing.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -203,7 +203,9 @@ gate, so they never need to be added to the exclude list.
203
203
Each schema-changing PR should add a section here documenting what changed,
204
204
what the upgrade script handles, and any backward compatibility considerations.
205
205
206
-
### 0.2.8
206
+
### v0.2.7 → v0.2.8
207
+
208
+
#### Loop failure continuation
207
209
208
210
-`sql/pg_durable--0.2.7--0.2.8.sql` renames `df.loop(text, text)` to
209
211
`df._loop_legacy(text, text)`, preserving its function OID and dependent
@@ -233,6 +235,12 @@ what the upgrade script handles, and any backward compatibility considerations.
233
235
binary, which continues toward the higher backstop instead. Drain such
234
236
long-running loops before upgrade when continuity is required.
235
237
238
+
#### Add `df.with_http_options()`
239
+
-**DDL change:** Adds `df.with_http_options(fut text, options jsonb) RETURNS text`. The input must be a single `HTTP` or `HTTP_MULTIPART` node. No option keys are supported yet: SQL `NULL` and `{}` return the original node text byte-for-byte; other values and unsupported keys raise an error.
240
+
-**Upgrade script:**[sql/pg_durable--0.2.7--0.2.8.sql](../sql/pg_durable--0.2.7--0.2.8.sql) adds this helper without replacing the existing HTTP functions. The new helper uses the same schema-access and default PUBLIC `EXECUTE` model as other combinators; it does not grant HTTP access.
241
+
-**Scenario A considerations:** The added function matches pgrx-generated fresh-install SQL, including argument names, null handling and the `with_http_options_wrapper` C symbol.
242
+
-**Scenario B1 considerations:** The new helper remains absent until `ALTER EXTENSION UPDATE`. The new `.so` exports `with_http_options_wrapper`; existing HTTP function signatures, C symbols, OIDs and ACLs are unchanged.
0 commit comments