question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The column "TenantId" does not exist

See original GitHub issue

I use latest FB preview, EF 3.1.4 for PostgreSQL. I am not sure what is the source of the problem but i receive the exception during query my Customers Set: Column does not exist: i.e. I see the query

   {SELECT c.id, c.accounts_contact, c.address,c.name, c.tel, c."TenantId", c.towncity, c.web
FROM customers AS c
WHERE c."TenantId" = $1}


The matter is: the field “TenantId” was added (why) to the correct query, but it is not in the table and naturally PostgreSQL error. Why the field “TenantId” is in the query? How I can fix it?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AndrewTriesToCodecommented, Jul 17, 2020

Hi, In the sample two of them should be sharing a single database and one should have it’s own. I’ll double check it today and maybe I can make it more clear. I think it might be clearer to have separate sample projects like you say but also to have the existing one-there are cases where you might have a mix of shared and separate databases.

1reaction
AndrewTriesToCodecommented, Jul 16, 2020

@win32nipuh

Based on your email I would recommend that your db context NOT derive from MultiTenantDbContext. It’s main functionality is to support tenants sharing a database, but your use case is separate database per tenant.

In your case I recommend you inherit from the normal DbContext', inject the tenant info into the constructor, and set the connection in OnConfiguringusing the tenant infoConnectionString`.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SpringBoot + PostgreSQL "Column does not exist"
This can be caused because your database schema is not in synced with your Entity class. My advice is to inspect your database...
Read more >
How to Fix Column Does not Exist Exception/Error in ...
In PostgreSQL, the “column doesn't exist” error can occur because of various reasons, such as the searched column doesn't exist in the targeted ......
Read more >
Unique Constraint on 2 columns or single column and null ...
Name AND NOT EXISTS (SELECT i.TenantId INTERSECT SELECT it.TenantId) -- nullable compare AND (i.TenantId IS NULL OR it.TenantId IS NULL) ...
Read more >
Serverless SQL pool self-help - Azure Synapse Analytics
This article contains information that can help you troubleshoot problems with serverless SQL pool.
Read more >
Not authorized or invalid query (System tree ...
The query status shows blank. The following error is seen in the console: Not authorized or invalid query. Not authorized or invalid query...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found