Error:Linqpad TypedDataContext missing Fk refs, if db has many schemas with identical table names
Error: Linpad TypedDataContext missing Fk references when Db has multiple schemas with the same table names
Environment:
- Windows 11 Pro
- Linqpad 8.3.7
- Oracle 23ai, autonomous database, serverless, hosted on OCI
- Linqpad Db connection: Entity Framework Core (multi-provider) (built-in). Provider: Oracle 8.23.40, EF Core version: 8.0.3, see screenshot below.
Issue:
- Linqpad is super cool, use it everyday, even weekends, thanks for progressing it :-)
- Linpad TypedDataContext is missing Fk references in all but one of the schemas, when the Db has multiple schemas with identical table names (table names are the same, naturally the Schema names will differ). The tables only reference tables in the same schema.
- Please note this was previously working correctly about a month ago.
- For all schemas (except one at random, let's call this the
ChosenSchema
), the Fk references to entities are missing in the auto generatedTypedDataContext
and missing in the server explorer user interface. - In the
ChosenSchema
, Fks are shown and operating correctly. - Here is small example to show the concept, two schemas, with identical named tables:
MAIN.TB_LE6FPT_PERSON MAIN.TB_LE6FPT_CLUB PLAYGROUND2.TB_LE6FPT_PERSON PLAYGROUND2.TB_LE6FPT_CLUB
Full Oracle Db script, to demonstrate the issue, (the prefix LE6FPT
just to avoid name collisions on my server!):
drop table if exists MAIN.TB_LE6FPT_PERSON cascade constraints purge; drop table if exists MAIN.TB_LE6FPT_CLUB cascade constraints purge; drop table if exists MAIN.TB_LE6FPT_SKILL cascade constraints purge; drop table if exists PLAYGROUND2.TB_LE6FPT_PERSON cascade constraints purge; drop table if exists PLAYGROUND2.TB_LE6FPT_CLUB cascade constraints purge; drop table if exists PLAYGROUND2.TB_LE6FPT_SKILL cascade constraints purge; CREATE table MAIN.TB_LE6FPT_CLUB ( ID NUMBER(18) NOT NULL constraint PK_TB_LE6FPT_CLUB primary key, NOTES NVARCHAR2(100) ); CREATE table MAIN.TB_LE6FPT_SKILL ( ID NUMBER(18) NOT NULL constraint PK_TB_LE6FPT_SKILL primary key, NOTES NVARCHAR2(100) ); CREATE table MAIN.TB_LE6FPT_PERSON ( ID NUMBER(18) NOT NULL constraint PK_TB_LE6FPT_PERSON primary key, NOTES NVARCHAR2(100), TOP_SKILL_ID NUMBER(18) constraint FK_TB_LE6FPT_PERSON_TO_TB_LE6FPT_SKILL_TOP_SKILL_ID references MAIN.TB_LE6FPT_SKILL, FAV_CLUB_ID_A NUMBER(18) constraint FK_TB_LE6FPT_PERSON_TO_TB_LE6FPT_CLUB_FAV_CLUB_ID_A references MAIN.TB_LE6FPT_CLUB, FAV_CLUB_ID_B NUMBER(18) constraint FK_TB_LE6FPT_PERSON_TO_TB_LE6FPT_CLUB_FAV_CLUB_ID_B references MAIN.TB_LE6FPT_CLUB ); -- PLAYGROUND2 CREATE table PLAYGROUND2.TB_LE6FPT_CLUB ( ID NUMBER(18) NOT NULL constraint PK_TB_LE6FPT_CLUB primary key, NOTES NVARCHAR2(100) ); CREATE table PLAYGROUND2.TB_LE6FPT_SKILL ( ID NUMBER(18) NOT NULL constraint PK_TB_LE6FPT_SKILL primary key, NOTES NVARCHAR2(100) ); CREATE table PLAYGROUND2.TB_LE6FPT_PERSON ( ID NUMBER(18) NOT NULL constraint PK_TB_LE6FPT_PERSON primary key, NOTES NVARCHAR2(100), TOP_SKILL_ID NUMBER(18) constraint FK_TB_LE6FPT_PERSON_TO_TB_LE6FPT_SKILL_TOP_SKILL_ID references PLAYGROUND2.TB_LE6FPT_SKILL, FAV_CLUB_ID_A NUMBER(18) constraint FK_TB_LE6FPT_PERSON_TO_TB_LE6FPT_CLUB_FAV_CLUB_ID_A references PLAYGROUND2.TB_LE6FPT_CLUB, FAV_CLUB_ID_B NUMBER(18) constraint FK_TB_LE6FPT_PERSON_TO_TB_LE6FPT_CLUB_FAV_CLUB_ID_B references PLAYGROUND2.TB_LE6FPT_CLUB );
- Attached screenshots:
- Schema
MAIN
, working correctly: - Schema
PLAYGROUND2
, NOT working, FKs references are missing: - Db connection details"
Comments
Hello Linqpad, I'd really appreciate an update, seems to be killing our wonderful Linqpad scripts from working!
The issue is caused by having two foreign key constraints with the same name. This has been fixed in 8.4.11:
https://www.linqpad.net/linqpad8.aspx#beta
Brilliant thanks @JoeAlbahari, speedy as ever, I'll check it out!