Skip to content

Switch error code to TABLE_NOT_FOUND if all columns filtered out#18451

Merged
findepi merged 1 commit intotrinodb:masterfrom
codyzwief:codyzwief/error-messaging
Oct 20, 2023
Merged

Switch error code to TABLE_NOT_FOUND if all columns filtered out#18451
findepi merged 1 commit intotrinodb:masterfrom
codyzwief:codyzwief/error-messaging

Conversation

@codyzwief
Copy link
Copy Markdown
Contributor

@codyzwief codyzwief commented Jul 28, 2023

Description

This is a minor change that modifies the error message when all columns in a select query get filtered out to be of TABLE_NOT_FOUND error code instead of COLUMN_NOT_FOUND.

Additional context and related issues

Release notes

( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text:

# Section
* Switch error code to `TABLE_NOT_FOUND` if all columns filtered out from access control

@cla-bot cla-bot bot added the cla-signed label Jul 28, 2023
@codyzwief codyzwief marked this pull request as ready for review July 29, 2023 03:00
@codyzwief codyzwief changed the title [WIP] Switch error code to TABLE_NOT_FOUND if all columns filtered out Switch error code to TABLE_NOT_FOUND if all columns filtered out Jul 29, 2023
List<Field> fields = filterInaccessibleFields(requestedFields);
if (fields.isEmpty()) {
if (!requestedFields.isEmpty()) {
throw semanticException(TABLE_NOT_FOUND, allColumns, "Relation not found or not allowed");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Or should this be AccessDeniedException?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I went back and forth on this; I left it as not found to:

  • Match current COLUMN_NOT_FOUND error code
  • Leave room for columns to be filtered out not due to access control reasons

However I would be open to change.

@findepi findepi merged commit 82be8a7 into trinodb:master Oct 20, 2023
@github-actions github-actions bot added this to the 430 milestone Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants