Skip to content

SqliteDataReader.GetStream is not working correctly in presence of composite primary keys #23554

Closed

Description

File a bug

For a table definition CREATE TABLE "a" ("id" INTEGER NOT NULL, "name" TEXT, "value" TEXT, PRIMARY KEY ("id", "name")); the code in SqliteDataReader.GetStream would incorrectly interpret the "id" column as being the row ID. This happens because sqlite3_table_column_metadata identifies the id column as primary key and it has the INTEGER type. However, this is not satisfactory condition in presence of the composite primary keys and it will incorrectly identify the column as equivalent to rowid which it is not.

It's not trivial to fix the optimization since not all of the columns from the composite key have to be present as part of the result set so essentially all of the columns in the table would have to be examined to rule out the presence of the composite primary key.

Include version information

Microsoft.Data.Sqlite version: 3bd012b
Target framework: .NET 5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions