Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve catalog error message for missing schemas#19922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
krleonid wants to merge11 commits intoduckdb:main
base:main
Choose a base branch
Loading
fromkrleonid:improve_catalog_error_message

Conversation

@krleonid
Copy link
Contributor

@krleonidkrleonid commentedNov 25, 2025
edited
Loading

This PR improves catalog error messages for missing schemas.

Changes

  • Improve catalog error message for missing schemas

When querying a table in a non-existent schema, the error messagenow correctly indicates that the schema does not exist, rather thansaying the table does not exist.The new error message format is:'Catalog with name <schema> does not exist and there is no <schema> schema in the current catalog!'This provides clearer feedback to users when they reference a schemathat doesn't exist, making it easier to identify and fix the issue.Changes:- Added logic in Catalog::TryLookupEntry to detect when a schema  doesn't exist and throw an appropriate error- Simplified code by removing redundant checks- Added comprehensive tests for various scenarios including:  - Non-existent schema without catalog specification  - Non-existent schema with catalog specification  - Non-existent table in existing schema (still shows table error)  - Multiple catalog scenarios
- Add check to only apply schema error logic when looking for TABLE_ENTRY- This prevents incorrect schema errors for column.method calls like filename.replace()- Update test expectations to match new accurate error messages- All tests pass including dot_function_missing_error.test
@krleonidkrleonid marked this pull request as draftNovember 25, 2025 07:31
@krleonidkrleonid marked this pull request as ready for reviewNovember 25, 2025 07:31
Copy link
Collaborator

@pdetpdet left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, i had a small comment about it.

Comment on lines 918 to 922
EntryLookupInfoschema_lookup(CatalogType::SCHEMA_ENTRY, schema_name, lookup_info.GetErrorContext());
auto except =CatalogException(
schema_lookup.GetErrorContext(),
"Catalog with name %s does not exist and there is no %s schema in the current catalog!", schema_name,
schema_name);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't "Schema with name %s does not exist!" be a more clear error message?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The other option would be to have an error message closer to what postgres does:

ERROR:  relation "s.t1" does not existLINE 1: select * from s.t1

krleonid reacted with rocket emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@taniabogatsch WDYT? What should the error message be?
I think it’s a good idea to have a message similar to Postgres.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I like that, too - let's go with Postgres similarity. 👍

krleonid reacted with thumbs up emojikrleonid reacted with heart emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Updated error message from 'Catalog with name X does not exist and there is no X schema in the current catalog!' to 'the relation "schema.table" does not exist' format. This provides clearer error messages showing the full qualified relation name.
@krleonidkrleonid marked this pull request as draftNovember 27, 2025 05:42
@krleonidkrleonid marked this pull request as ready for reviewNovember 27, 2025 05:42
@krleonidkrleonid marked this pull request as draftNovember 27, 2025 05:49
- Updated catalog.cpp to generate error message in format 'the relation "schema.table" does not exist'- Updated all test files to expect the new error message format- Fixed remaining occurrences in test_schema.test and test_schema_dependency.test
@krleonidkrleonid marked this pull request as ready for reviewNovember 27, 2025 19:34
EntryLookupInfoschema_lookup(CatalogType::SCHEMA_ENTRY, schema_name, lookup_info.GetErrorContext());
string relation_name = schema_name +"." + lookup_info.GetEntryName();
auto except =
CatalogException(schema_lookup.GetErrorContext(),"the relation\"%s\" does not exist", relation_name);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's stick to "Table with name" for consistency with the other error message

Copy link
Contributor

Choose a reason for hiding this comment

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

But that caused the confusion in the first place, no? Since it was not actually the table that was missing?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The table is missing, otherwise the look-up wouldn't fail. The confusion is that the error doesn't happen in the look-up of the table name, but in the look-up of the schema, which is not included as part of the error message.

Note that "relation" is just how Postgres calls tables.

Copy link
Contributor

@taniabogatschtaniabogatschNov 28, 2025
edited
Loading

Choose a reason for hiding this comment

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

Screenshot 2025-11-28 at 13 30 40

So to confirm: looking at, e.g., this change. We want to stay with "table" and we want the error message to say:
Catalog Error: Table with name "s1.test does not exist`?

Copy link
Contributor

@taniabogatschtaniabogatschNov 28, 2025
edited
Loading

Choose a reason for hiding this comment

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

Isn't that still misleading because, like you said, it happens during schema lookup? Shouldn't we at least add something likebecause schema "s1" does not exist?

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 fine with that, but that is a more involved change in this PR. My comment here was to basically say "I don't see a reason to switch nomenclature from "Table" to "relation" for this error message"

taniabogatsch reacted with thumbs up emoji
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@MytherinMytherinMytherin left review comments

@pdetpdetAwaiting requested review from pdet

+1 more reviewer

@taniabogatschtaniabogatschtaniabogatsch approved these changes

Reviewers whose approvals may not affect merge requirements

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@krleonid@Mytherin@pdet@taniabogatsch

[8]ページ先頭

©2009-2025 Movatter.jp