Skip to content

Fix misleading iceberg catalog option error messages#368

Open
sfc-gh-npuka wants to merge 1 commit into
mainfrom
naisila/error_cleanup
Open

Fix misleading iceberg catalog option error messages#368
sfc-gh-npuka wants to merge 1 commit into
mainfrom
naisila/error_cleanup

Conversation

@sfc-gh-npuka
Copy link
Copy Markdown
Collaborator

The FDW validator in pg_lake_iceberg used error messages that said options were "only valid for writable catalog="rest"" when they are actually valid for read-only external catalog tables (both catalog=rest and catalog=object_store). Similarly, "required for catalog="rest"" omitted that the same options are required for catalog=object_store read-only tables.

Changes:

  • Reword all "only valid for" / "required for" error messages for catalog_name, catalog_namespace, catalog_table_name, and read_only to accurately describe which catalog types they apply to.
  • Remove a dead "catalog_namespace required" check: it only applied to REST read-only (object_store excluded), but the REST ALTER whitelist never allows touching catalog_namespace and CREATE auto-fills a default, so the path was unreachable.
  • Clean up stale copy-pasted comments in ProcessAlterTable that referenced "catalog_table_name only" in the object_store branch and add a comment explaining the validator interaction.
  • Add a comment in option.c noting that the remaining "required" checks act as a safety net for ALTER DROP scenarios.

Tests:

  • test_iceberg_catalog_option_validation_errors (test_writable_iceberg.py): exercises the four "only valid for read-only external catalog tables" rejection paths without needing external infrastructure.
  • test_object_store_read_only_alter_drop_required_options (test_object_store_catalog.py): exercises the two "required" paths via ALTER FOREIGN TABLE OPTIONS (DROP ...) on an object_store read-only table.

Checklist

  • I have tested my changes and added tests if necessary
  • I updated documentation if needed
  • I confirm that all my commits are signed off (DCO)

DCO Reminder (important)

This project uses the Developer Certificate of Origin (DCO).
DCO is a simple way for you to confirm that you wrote your code and that you have the right to contribute it.

If the DCO check fails, please sign off your commits.

How to sign off

For your last commit:
git commit --amend -s
git push --force

For multiple commits:
git rebase --signoff main
git push --force

More info: https://developercertificate.org/

The FDW validator in pg_lake_iceberg used error messages that said
options were "only valid for writable catalog=\"rest\"" when they are
actually valid for read-only external catalog tables (both catalog=rest
and catalog=object_store). Similarly, "required for catalog=\"rest\""
omitted that the same options are required for catalog=object_store
read-only tables. The error raised for an unknown "catalog" value also
listed only "rest" and "postgres", omitting "object_store".

Changes:
- Reword all "only valid for" / "required for" error messages for
  catalog_name, catalog_namespace, catalog_table_name, and read_only
  to accurately describe which catalog types they apply to.
- Update the "invalid catalog option" errdetail and surrounding block
  comment to include object_store alongside rest and postgres.
- Remove a dead "catalog_namespace required" check: it only applied to
  REST read-only (object_store excluded), but the REST ALTER whitelist
  never allows touching catalog_namespace and CREATE auto-fills a
  default, so the path was unreachable.
- Rework the comments in ProcessAlterTable: the outer block comment
  now describes external catalog handling (was "rest" only) and the
  validator interaction, and each per-branch comment accurately
  describes which options that catalog type allows changing (the
  previous object_store branch comment was a stale copy-paste of the
  rest branch comment).
- Add a comment in option.c noting that the remaining "required"
  checks act as a safety net for ALTER DROP scenarios.

Tests:
- test_iceberg_catalog_option_validation_errors (test_writable_iceberg.py):
  exercises the four "only valid for read-only external catalog tables"
  rejection paths plus the "invalid catalog option" path without
  needing external infrastructure.
- test_object_store_read_only_alter_drop_required_options
  (test_object_store_catalog.py): exercises the two "required" paths
  via ALTER FOREIGN TABLE OPTIONS (DROP ...) on an object_store
  read-only table.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: sfc-gh-npuka <naisila.puka@snowflake.com>
@sfc-gh-npuka sfc-gh-npuka force-pushed the naisila/error_cleanup branch from b08defb to 50e10ad Compare May 25, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants