Commit 87dbbc1
Use iceberg_catalog server OID as canonical REST catalog identity
Now that every REST catalog -- built-in and user-created -- is backed by
a real iceberg_catalog foreign server, the server's OID is a stable,
unambiguous identifier. This commit pivots the in-memory machinery off
case-insensitive name comparison and onto OID equality.
* RestCatalogOptions gains a leading `Oid serverOid` field, populated in
BuildRestCatalogOptionsFromServer from server->serverid and propagated
by CopyRestCatalogOptions. The struct comment is updated to call out
that `catalog` is now purely a user-facing label kept around for error
messages, and that `serverOid` is the canonical identity.
* The per-catalog OAuth token cache is rekeyed from a NAMEDATALEN char
buffer to sizeof(Oid). BuildTokenCacheKey is removed; the lookup site
now passes &opts->serverOid directly, with a defensive
Assert(OidIsValid(opts->serverOid)) so a future caller that forgets to
resolve options cannot silently funnel every catalog into the same
cache slot. InvalidateRestTokenCache keeps its existing full-flush
behavior on any pg_foreign_server change; targeted invalidation is
not worth the per-entry bookkeeping at the rate ALTER SERVER actually
happens.
* The cross-transaction "same REST catalog throughout" guard in
BindRelationToXactRestCatalog and the belt-and-suspenders branch of
RecordRestCatalogRequestInTx now compare serverOid directly instead
of pg_strcasecmp'ing catalog names. The two user-facing names are
still surfaced in errdetail so the message remains in the terms the
user typed. This also closes the corner case where the same physical
server is referenced via different casings in successive statements:
they now collapse to the same OID and are treated as one catalog.
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: sfc-gh-npuka <naisila.puka@snowflake.com>1 parent 0e65cd7 commit 87dbbc1
3 files changed
Lines changed: 48 additions & 45 deletions
File tree
- pg_lake_iceberg
- include/pg_lake/rest_catalog
- src/rest_catalog
- pg_lake_table/src/transaction
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
| 71 | + | |
| 72 | + | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | 74 | | |
77 | 75 | | |
78 | | - | |
| 76 | + | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
| |||
527 | 525 | | |
528 | 526 | | |
529 | 527 | | |
530 | | - | |
531 | | - | |
| 528 | + | |
532 | 529 | | |
533 | 530 | | |
534 | 531 | | |
| |||
694 | 691 | | |
695 | 692 | | |
696 | 693 | | |
| 694 | + | |
697 | 695 | | |
698 | 696 | | |
699 | 697 | | |
| |||
748 | 746 | | |
749 | 747 | | |
750 | 748 | | |
| 749 | + | |
751 | 750 | | |
752 | 751 | | |
753 | 752 | | |
| |||
1230 | 1229 | | |
1231 | 1230 | | |
1232 | 1231 | | |
1233 | | - | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
1237 | | - | |
1238 | | - | |
1239 | | - | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
1243 | | - | |
1244 | | - | |
1245 | 1232 | | |
1246 | 1233 | | |
1247 | 1234 | | |
1248 | 1235 | | |
1249 | 1236 | | |
1250 | 1237 | | |
1251 | 1238 | | |
1252 | | - | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
1256 | 1243 | | |
1257 | 1244 | | |
1258 | 1245 | | |
| |||
1297 | 1284 | | |
1298 | 1285 | | |
1299 | 1286 | | |
1300 | | - | |
| 1287 | + | |
1301 | 1288 | | |
1302 | 1289 | | |
1303 | 1290 | | |
| |||
1309 | 1296 | | |
1310 | 1297 | | |
1311 | 1298 | | |
1312 | | - | |
| 1299 | + | |
1313 | 1300 | | |
1314 | 1301 | | |
1315 | 1302 | | |
| |||
1319 | 1306 | | |
1320 | 1307 | | |
1321 | 1308 | | |
1322 | | - | |
1323 | | - | |
1324 | | - | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
1325 | 1316 | | |
1326 | | - | |
| 1317 | + | |
1327 | 1318 | | |
1328 | 1319 | | |
1329 | 1320 | | |
1330 | | - | |
| 1321 | + | |
1331 | 1322 | | |
1332 | 1323 | | |
1333 | 1324 | | |
| |||
Lines changed: 11 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
663 | 665 | | |
664 | | - | |
665 | | - | |
| 666 | + | |
666 | 667 | | |
667 | 668 | | |
668 | 669 | | |
| |||
715 | 716 | | |
716 | 717 | | |
717 | 718 | | |
718 | | - | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
719 | 722 | | |
720 | | - | |
| 723 | + | |
721 | 724 | | |
722 | 725 | | |
723 | 726 | | |
| |||
0 commit comments