12.3. Получение информации о прокси-таблицах #
В этом разделе описывается, как получить имена прокси-таблиц, а также связанных хранилищ и общих каталогов.
Сопоставления между прокси-таблицами и общими каталогами хранятся во внутренних таблицах axe_storages и axe_folders схемы axe на сервере Postgres Pro AXE.
12.3.1. Получение имён всех прокси-таблиц и связанных объектов #
Требуемые права:
право
USAGEна схемуaxe;право
SELECTна внутренние таблицыaxe_storagesиaxe_folders.
Выполните следующую команду на сервере Postgres Pro AXE:
SELECT
storage_name AS object_name,
'storage' AS object_type,
proxy_oid::regclass::text AS proxy_table_name
FROM axe.axe_storages
UNION ALL
SELECT
folder_name AS object_name,
'folder' AS object_type,
proxy_oid::regclass::text AS proxy_table_name
FROM axe.axe_folders
ORDER BY object_type, object_name;Имена прокси-таблиц используют префикс s_ для хранилищ и префикс f_ для общих каталогов. В обоих случаях после префикса следует UUID объекта.
Часть с UUID заключается в кавычки как SQL-идентификатор. Текстовое представление типа regclass может опускать имя схемы в зависимости от значения search_path. Для сравнений, которые не должны зависеть от формата вывода, используйте OID прокси-таблицы.
12.3.2. Получение имени прокси-таблицы с помощью имени объекта #
Требуемые права:
право
USAGEна схемуaxe;право
SELECTна внутреннюю таблицуaxe_storagesилиaxe_folders.
Выполните следующую команду на сервере Postgres Pro AXE:
SELECT proxy_oid::regclass::text AS proxy_table_name FROM axe.имя_таблицыWHEREстолбец_имени_объекта= 'имя_объекта';
Где:
имя_таблицы: имя таблицы, в которой хранится сопоставление.Возможные значения:
axe_storagesдля хранилищ;axe_foldersдля общих каталогов.
столбец_имени_объекта: имя столбца, в котором хранится имя объекта.Возможные значения:
storage_nameдля хранилищ;folder_nameдля общих каталогов.
имя_объекта: имя хранилища или общего каталога.
Пример 12.1. Получение имени прокси-таблицы для хранилища
SELECT proxy_oid::regclass::text AS proxy_table_name FROM axe.axe_storages WHERE storage_name = 'axe_storage';
Пример 12.2. Получение имени прокси-таблицы для общего каталога
SELECT proxy_oid::regclass::text AS proxy_table_name FROM axe.axe_folders WHERE folder_name = 'axe_folder';
12.3.3. Получение имени объекта с помощью имени прокси-таблицы #
Требуемые права:
право
USAGEна схемыaxeи_axe_proxy;право
SELECTна внутреннюю таблицуaxe_storagesилиaxe_folders.
Выполните следующую команду на сервере Postgres Pro AXE:
SELECTимя_объектаFROM axe.имя_таблицыWHERE proxy_oid = '_axe_proxy."имя_прокси_таблицы"'::regclass::oid;
Где:
имя_объекта: имя столбца, в котором хранится имя объекта.Возможные значения:
storage_nameдля хранилищ;folder_nameдля общих каталогов.
имя_таблицы: имя таблицы, в которой хранится сопоставление.Возможные значения:
axe_storagesдля хранилищ;axe_foldersдля общих каталогов.
имя_прокси_таблицы: имя прокси-таблицы с префиксомs_илиf_.
Пример 12.3. Получение имени хранилища
SELECT storage_name
FROM axe.axe_storages
WHERE proxy_oid =
'_axe_proxy."s_68e4bd9e-4bee-4ba6-8684-53d38cbc39c6"'::regclass::oid;Пример 12.4. Получение имени общего каталога
SELECT folder_name
FROM axe.axe_folders
WHERE proxy_oid =
'_axe_proxy."f_68e4bd9e-4bee-4ba6-8684-53d38cbc39c6"'::regclass::oid;Приведение имени к типу regclass вызывает ошибку, если отношение не существует.
12.3. Retrieving Information About Proxy Tables #
This section describes how to retrieve proxy table names and the names of associated storages and shared directories.
The mapping between proxy tables and associated storages and shared directories is stored in the axe_storages and axe_folders internal tables of the axe schema on the Postgres Pro AXE server.
12.3.1. Retrieving All Proxy Tables and Associated Object Names #
Required privileges:
the
USAGEprivilege on theaxeschemathe
SELECTprivilege on theaxe_storagesandaxe_foldersinternal tables
Execute the following command on the Postgres Pro AXE server:
SELECT
storage_name AS object_name,
'storage' AS object_type,
proxy_oid::regclass::text AS proxy_table_name
FROM axe.axe_storages
UNION ALL
SELECT
folder_name AS object_name,
'folder' AS object_type,
proxy_oid::regclass::text AS proxy_table_name
FROM axe.axe_folders
ORDER BY object_type, object_name;
Proxy table names use the s_ prefix for storages and the f_ prefix for shared directories. In both cases, the prefix is followed by the object UUID.
The UUID part is quoted as a SQL identifier. The textual regclass representation can omit the schema name depending on search_path. Use the proxy OID for comparisons that must not depend on the output format.
12.3.2. Retrieving a Proxy Table Name Using an Object Name #
Required privileges:
the
USAGEprivilege on theaxeschemathe
SELECTprivilege on theaxe_storagesoraxe_foldersinternal table
Execute the following command on the Postgres Pro AXE server:
SELECT proxy_oid::regclass::text AS proxy_table_name FROM axe.table_nameWHEREobject_name_column= 'object_name';
Where:
table_name: The name of the table that stores the mapping.Possible values:
axe_storagesfor storagesaxe_foldersfor shared directories
object_name_column: The name of the column that stores the object name.Possible values:
storage_namefor storagesfolder_namefor shared directories
object_name: The name of the storage or shared directory.
Example 12.1. Retrieving a Proxy Table Name for a Storage
SELECT proxy_oid::regclass::text AS proxy_table_name FROM axe.axe_storages WHERE storage_name = 'axe_storage';
Example 12.2. Retrieving a Proxy Table Name for a Shared Directory
SELECT proxy_oid::regclass::text AS proxy_table_name FROM axe.axe_folders WHERE folder_name = 'axe_folder';
12.3.3. Retrieving an Object Name Using a Proxy Table Name #
Required privileges:
the
USAGEprivilege on theaxeand_axe_proxyschemasthe
SELECTprivilege on theaxe_storagesoraxe_foldersinternal table
Execute the following command on the Postgres Pro AXE server:
SELECTobject_nameFROM axe.table_nameWHERE proxy_oid = '_axe_proxy."proxy_table_name"'::regclass::oid;
Where:
object_name: The name of the column that stores the object name.Possible values:
storage_namefor storagesfolder_namefor shared directories
table_name: The name of the table that stores the mapping.Possible values:
axe_storagesfor storagesaxe_foldersfor shared directories
proxy_table_name: The proxy table name with thes_orf_prefix.
Example 12.3. Retrieving a Storage Name
SELECT storage_name
FROM axe.axe_storages
WHERE proxy_oid =
'_axe_proxy."s_68e4bd9e-4bee-4ba6-8684-53d38cbc39c6"'::regclass::oid;
Example 12.4. Retrieving a Shared Directory Name
SELECT folder_name
FROM axe.axe_folders
WHERE proxy_oid =
'_axe_proxy."f_68e4bd9e-4bee-4ba6-8684-53d38cbc39c6"'::regclass::oid;
Casting a name to the regclass type raises an error if the relation does not exist.