Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide information about primary keys from ODBC GetSchema() #35442

Closed
MaceWindu opened this issue Apr 25, 2020 · 3 comments
Closed

Provide information about primary keys from ODBC GetSchema() #35442

MaceWindu opened this issue Apr 25, 2020 · 3 comments
Labels
area-System.Data.Odbc backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity

Comments

@MaceWindu
Copy link

Request, similar to #28517

Right now it is possible to get names and columns for primary keys, foreign keys and indexes for ODBC using Indexes schema table, but it is not possible to tell wether it actually PK, FK or Index.

This creates problem when you need this information from Access database, as GetSchema is the only way to get schema information for it. Most of ther databases allow you to query INFORMATION_SCHEMA or similar sources of schema information.

FYI, this information available over OleDb provider.

E.g. following test table (MS Access):

CREATE TABLE RelationsTable
(
	ID1		INT NOT NULL,
	ID2		INT NOT NULL,
	Int1	INT NOT NULL,
	Int2	INT NOT NULL,
	IntN1	INT NULL,
	IntN2	INT NULL,
	FK		INT NOT NULL,
	FKN		INT NULL
)
GO
CREATE INDEX PK_RelationsTable ON RelationsTable(ID1, ID2) WITH PRIMARY;
GO
CREATE INDEX IX_Index ON RelationsTable(Int1, IntN1);
GO
CREATE UNIQUE INDEX UX_Index1 ON RelationsTable(Int1);
GO
CREATE UNIQUE INDEX UX_Index2 ON RelationsTable(IntN1);
GO
ALTER TABLE RelationsTable ADD CONSTRAINT FK_Nullable FOREIGN KEY (IntN1, IntN2) REFERENCES RelationsTable(ID1, ID2);
GO
ALTER TABLE RelationsTable ADD CONSTRAINT FK_NotNullable FOREIGN KEY (Int1, Int2) REFERENCES RelationsTable(ID1, ID2);
GO

produce following data in Indexes table:
image
As you can see there is no way to distinguish index types. There is even some TYPE column, but it contains same obscure 3 value for all records.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Data untriaged New issue has not been triaged by the area owner labels Apr 25, 2020
@ajcvickers ajcvickers added this to the Future milestone Jun 23, 2020
@ajcvickers ajcvickers removed the untriaged New issue has not been triaged by the area owner label Jun 23, 2020
@roji
Copy link
Member

roji commented Aug 14, 2020

As in #35444, are you using this info returned from other, non-Access ODBC providers?

Copy link
Contributor

Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

This process is part of our issue cleanup automation.

@dotnet-policy-service dotnet-policy-service bot added backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity labels Feb 13, 2025
Copy link
Contributor

This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

@dotnet-policy-service dotnet-policy-service bot removed this from the Future milestone Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Data.Odbc backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity
Projects
None yet
Development

No branches or pull requests

4 participants