Potential name conflict problems when multiple items in different DB Namespaces have the same name
I'm offering this up as a potential bug/issue with the caveat that I am by no means a DataBase (or LINQPad) expert and as such this behaviour may well be to be expected or desired. This is in reference to my comment in this thread regarding tables that seem to be missing from the database.
Based on some out-of-band comments from kingkeith I uncovered what appears to be the reason why the table I mentioned was missing.
To recap, I have a SQL Server 2008 R2 database deployed on three distinct servers, and in all cases there is at least one table (named Price) that doesn't appear in the table list for the connection. I tested across both LINQPad 4 as well as the latest release and beta builds of LINQPad 5.
The table itself doesn't appear special in any way as far as the schema goes, and despite the fact that it doesn't appear in the list of tables in the connection (even after a refresh), manually querying from it via SQL works just fine, although something like Price.Take(10) in a C# expression query generates an error that the name doesn't exist in the current context.
Hints from keith about whether or not the table appears in the Intellisense popup eventually led to what appears to be an explanation for this issue.
The servers in question have SQLFinancials installed, which is an external assembly that provides some functions to the database. The extension itself has a function in it named Price.
As far as the Database itself is concerned, the function is only invocable as Excel.Price(), and in the tree view in LINQPad it appears under Excel > Functions > Price in the tree.
As mentioned above, Price.Take(10) doesn't work because it doesn't know what that is, and PRICE.Take(10) (with different case) generates a similar error, only the full symbol name is the signature of the aforementioned function.
It seems as though since the function is distinctly located in an appropriate part of the tree view and also appears to have a different case as far as the C# mode is concerned that LINQPad is discarding it as a table because there's another item with the same name or something along those lines.
I'm not sure if that's an actual bug or something that needs to be done when symbols of the same name appear in different contexts, though.
Based on some out-of-band comments from kingkeith I uncovered what appears to be the reason why the table I mentioned was missing.
To recap, I have a SQL Server 2008 R2 database deployed on three distinct servers, and in all cases there is at least one table (named Price) that doesn't appear in the table list for the connection. I tested across both LINQPad 4 as well as the latest release and beta builds of LINQPad 5.
The table itself doesn't appear special in any way as far as the schema goes, and despite the fact that it doesn't appear in the list of tables in the connection (even after a refresh), manually querying from it via SQL works just fine, although something like Price.Take(10) in a C# expression query generates an error that the name doesn't exist in the current context.
Hints from keith about whether or not the table appears in the Intellisense popup eventually led to what appears to be an explanation for this issue.
The servers in question have SQLFinancials installed, which is an external assembly that provides some functions to the database. The extension itself has a function in it named Price.
As far as the Database itself is concerned, the function is only invocable as Excel.Price(), and in the tree view in LINQPad it appears under Excel > Functions > Price in the tree.
As mentioned above, Price.Take(10) doesn't work because it doesn't know what that is, and PRICE.Take(10) (with different case) generates a similar error, only the full symbol name is the signature of the aforementioned function.
It seems as though since the function is distinctly located in an appropriate part of the tree view and also appears to have a different case as far as the C# mode is concerned that LINQPad is discarding it as a table because there's another item with the same name or something along those lines.
I'm not sure if that's an actual bug or something that needs to be done when symbols of the same name appear in different contexts, though.
Comments
The first bit is this simple C# code that implements the function that will be referenced shortly. With the exception of changing the target version of .NET to 2.0 so that SQL Server wouldn't get mad about it, I didn't customize anything about the build at all.
The Database side of things is demonstrated by this: This executes without errors, and the tree view in LINQPad appears as the following (even after a refresh):
From an SQL Query, SELECT'ing from the table works, as does calling EXTNS.Price(), but in C# only the function version appears in the intellisense popup and as far as the tree is concerned only the function exists.