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

MSSQL TableExists cannot find the table #456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vitiokss
Copy link

@vitiokss vitiokss commented Jul 6, 2018

There are different approaches on configuring and using your sql server:

  • create new schemas, databases
  • using default schema dbo etc...

Current issue:
When you use default dbo schema, it cannot find your collection table name in schema information table. It makes a wrong query to information_schema.tables where d.BaseDatabase.Name() method returns the database name instead of schema name. The issue is that we are looking up for database name in table_schema column, which in our case is dbo. So the record is not being found, and it is a problem.

Solution:
I have tried to make as small change as possible to not impact the original implementation, in case d.BaseDatabase.Name() would return the schema name instead of database name.
For that, I just add one more Or condition to check for database_name (table_catalog)

@xiam
Copy link
Member

xiam commented Jul 7, 2018

Thanks @vitiokss, do you know if there's another way to know if a table exists without the ambiguity of having an OR in the condition? Maybe the problem is that upper is not making a difference between schema and database from the beginning.

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.

None yet

2 participants