Getting information from the Babelfish system catalog
You can obtain information about the database objects that are stored in your Babelfish cluster by querying many of the same system views as used in SQL Server. Each new release of Babelfish adds support for more system views. For a list of available views currently available, see the SQL Server system catalog views table.
These system views provide information from the system catalog
(sys.schemas
). In the case of Babelfish,
these views contain both SQL Server and PostgreSQL system schemas.
To query Babelfish for system catalog information, you can
use the TDS port or the PostgreSQL port, as shown in the
following examples.
Query the T-SQL port using
sqlcmd
or another SQL Server client.1>
SELECT * FROM sys.schemas2>
GOThis query returns SQL Server and Aurora PostgreSQL system schemas, as shown in the following.
name --------------------------------------------------------- demographic_dbo public sys master_dbo tempdb_dbo ...
Query the PostgreSQL port using
psql
orpgAdmin
. This example uses thepsql
list schemas metacommand (\dn
):babelfish_db=>
\dnThe query returns the same result set as that returned by
sqlcmd
on the T-SQL port.List of schemas Name ------------------------------ demographic_dbo public sys master_dbo tempdb_dbo ...
SQL Server system catalogs available in Babelfish
In the following table you can find the SQL Server views currently implemented in Babelfish. For more information about
the system catalogs in SQL Server, see
System
Catalog Views (Transact-SQL)
View name | Description or Babelfish limitation (if any) |
---|---|
|
All columns in all tables and views |
|
All objects in all schemas |
|
The union of |
|
All views in all schemas |
|
All columns in user-defined tables and views |
|
Babelfish support limited to a single read-only configuration. |
|
Contains a row for each data space. This can be a filegroup, partition scheme, or FILESTREAM data filegroup. |
|
A per-database view that contains one row for each file of a database as stored in the database itself. |
|
For information, see
sys.database_mirroring |
|
For information, see
sys.database_principals |
|
For information, see
sys.database_role_members |
|
All databases in all schemas |
|
For information, see
sys.dm_exec_connections |
|
For information, see
sys.dm_exec_sessions |
|
For information, see
sys.dm_hadr_database_replica_states |
|
For information, see sys.dm_os_host_info |
|
For information, see
sys.endpoints |
|
For information, see sys.indexes |
|
For information, see sys.languages |
|
All schemas |
|
All logins and roles |
|
For information, see sys.sql_modules |
|
Babelfish support limited to a single read-only configuration. |
|
Babelfish support limited to a single read-only configuration. |
|
For information, see
sys.sysprocesses |
|
For information, see sys.system_sql_modules |
|
For information, see sys.table_types |
|
All tables in a schema |
|
For information, see
sys.xml_schema_collections |
PostgreSQL implements system catalogs that are similar to the SQL Server object catalog
views. For a complete list of system catalogs, see System Catalogs