Table Valued Functions in SQL Server, PostGIS and Oracle are a fantastic way to pull back data to GIS simply by passing a variable. This avoids the need of creating thousands of views, you can simply have one TVF and pass a parameter or two.
At the moment you can add a table valued function into GIS using a select * statement but for some unexplainable reason the data that is plotted on the screen is correct but the attribute table doesn't show all the data contained within the TVF. Apparently this is because the TVF does not support Spatial Indexes but alas you can add views without Spatial Indexes using this method and view content within the attribute table without issue.
Instead of this being reported as a bug, ESRI has suggested posting this as an Idea/enhancement request. They have duly raised an enhancement request – ENH-000102584. If this was truly a query layer it should support all sql object (TVF's, Stored Procedures etc) rather than just provide support tables and views.
Please vote for my suggestion. If you use lots of views from a database, trust me this will be saving you hours.
Cheers
Oliver