Skip to content

Conversation

@sfc-gh-abozkurt
Copy link
Collaborator

@sfc-gh-abozkurt sfc-gh-abozkurt commented Nov 24, 2025

Remove unnecessary read only iceberg table errors. postgresIsForeignRelUpdatable should handle all dml errors.
We should throw error only for alter and truncate commands.

if (PgLakeCopyValidityCheckHook)
PgLakeCopyValidityCheckHook(relationId);

ErrorIfReadOnlyIcebergTable(relationId);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already do not push down such cases at IsCopyFromPushdownable.

* deletion.
*/
if (!IsReadOnlyIcebergTable(relationId))
if (IsWritableIcebergTable(relationId))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsWritableIcebergTable is correct one after refactor. if block, which puts iceberg files to deletion queue, should only apply to writable iceberg tables.

* throws an error if it is.
*/
void
ErrorIfReadOnlyIcebergTable(Oid relationId)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not very much convinced that we get rid of ErrorIfReadOnlyIcebergTable, and introduce the same function in different places.

Can you remind me what is the reason not adjusting this one? I think having a single error message is even cleaner. For example, Postgres give a single error in read-only mode, which is a cleaner signal in the long term, compared to multiple different errors.

Copy link
Collaborator Author

@sfc-gh-abozkurt sfc-gh-abozkurt Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We error only for read-only iceberg tables at alter hook. We error for both read-only iceberg and pg_lake tables at truncate.

Question: Shouldn't we also throw error for read-only pg_lake tables during alter commands? If so, we can create a more generic error function that can be reused for all modification cases.

@sfc-gh-abozkurt sfc-gh-abozkurt force-pushed the aykut/refactor-internal-external branch from e3858c7 to 0d01cfc Compare November 25, 2025 20:37
@sfc-gh-abozkurt sfc-gh-abozkurt force-pushed the aykut/read-only-refactor branch from 563b36c to 1e5f0b7 Compare November 25, 2025 20:38
Base automatically changed from aykut/refactor-internal-external to main November 25, 2025 20:51
@sfc-gh-abozkurt sfc-gh-abozkurt force-pushed the aykut/read-only-refactor branch from 1e5f0b7 to aa9de74 Compare November 25, 2025 20:52
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.

3 participants