Skip to content

Fix getting wrong schema with CommandBehavior.SchemaOnly and autoprepare#6040

Merged
vonzshik merged 2 commits intomainfrom
6038-auto-prepare-schema-only-row-description-fix
Oct 5, 2025
Merged

Fix getting wrong schema with CommandBehavior.SchemaOnly and autoprepare#6040
vonzshik merged 2 commits intomainfrom
6038-auto-prepare-schema-only-row-description-fix

Conversation

@vonzshik
Copy link
Contributor

@vonzshik vonzshik commented Mar 5, 2025

Fixes #6038

This one was annoying. For some reason we've been missing quite a big chunk of AutoPrepare logic around CommandBehavior.SchemaOnly. @roji would be great if you can also take a look in case I missed something.

@vonzshik vonzshik requested a review from roji as a code owner March 5, 2025 10:51
@vonzshik vonzshik force-pushed the 6038-auto-prepare-schema-only-row-description-fix branch from 0a2dc23 to 870e3c7 Compare September 10, 2025 11:41
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

Thanks @vonzshik, yeah, looks like the SchemaOnly paths got quite out of sync with the main paths. I wonder if it's feasiable and worth looking at merging the paths (e.g. in NpgsqlDataReader) so we don't have to maintain two...


// Found a resultset
if (RowDescription is not null)
{
Copy link
Member

Choose a reason for hiding this comment

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

I don't have much context over this, but do you remember why we need this in the regular path but not here in the SchemaOnly path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We only need ColumnInfoCache while reading columns, and since with SchemaOnly we do not have a result set, there is no reason for us to even touch the cache.

@vonzshik vonzshik merged commit 5ede53c into main Oct 5, 2025
16 checks passed
@vonzshik vonzshik deleted the 6038-auto-prepare-schema-only-row-description-fix branch October 5, 2025 18:47
vonzshik added a commit that referenced this pull request Oct 5, 2025
vonzshik added a commit that referenced this pull request Oct 5, 2025
@vonzshik
Copy link
Contributor Author

vonzshik commented Oct 5, 2025

Backported to 9.0.4 via 3b6c74c, 8.0.8 via 43e15ee

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.

Issues with NpgsqlCommandBuilder: Incorrect Table Schema and Slow Command Generation

3 participants