Search

[DOC] : INFORMATION_SCHEMA.TABLES gives improper warning about schema by aaronbertrand

Closed
as Fixed Help for as Fixed

2
1
Sign in
to vote
Type: Bug
ID: 686118
Opened: 8/29/2011 8:45:24 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
In the following topic:

http://msdn.microsoft.com/en-us/library/ms186224.aspx

For the TABLE_SCHEMA column, this warning appears:

<snip>
Do not use INFORMATION_SCHEMA views to determine the schema of an object. The only reliable way to find the schema of a object is to query the sys.objects catalog view.
</snip>

This warning is not correct. If you look at the object_definition of INFORMATION_SCHEMA.TABLES, it points to the same schema_id column as sys.objects, so there is no situation where sys.objects would be correct but INFORMATION_SCHEMA would be incorrect.

Perhaps this is a lingering piece of information from a time when objects could be orphaned in a way that INFORMATION_SCHEMA views were not updated (e.g. my messing with system tables directly)?

Now, I realize that we do want to push people toward the catalog views, however it is for a different reason. We are not afraid that INFORMATION_SCHEMA views are incorrect, but rather that they are incomplete. For example, the INFORMATION_SCHEMA views contain no information about newer features such as included columns and filtered indexes.
Details (expand)

Product Language

English

Version

SQL Server 2008 R2 SP1

Category

Documentation

Operating System

Not Applicable

Operating System Language

US English

Steps to Reproduce

Go to the topic TABLES:

http://msdn.microsoft.com/en-us/library/ms186224.aspx

Read the note about schema being unreliable.

Actual Results

The note warns that INFORMATION_SCHEMA.TABLES cannot be relied upon to return the correct schema for an object, even though it derives this value directly from sys.objects - which is the recommended alternative.

Expected Results

There should be no warning here about schema.

Platform

X64

Virtualization

 
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 8/29/2012 at 3:42 PM
Thanks for your feedback. I updated the topic by adding "INFORMATION_SCHEMA views could be incomplete since they are not updated for all new features" to the alert.
The alert now reads:
Do not use INFORMATION_SCHEMA views to determine the schema of an object. The only reliable way to find the schema of an object is to query the sys.objects catalog view. INFORMATION_SCHEMA views could be incomplete since they are not updated for all new features.
Posted by Microsoft on 8/31/2011 at 4:51 PM
Hi Aaron,
That particular wording has been in the topic since 2005. But, I see your point. We'll revist the wording and try to make it more clear.

Regards,
Gail Erickson
SQL Server Documentation Team
Sign in to post a workaround.