我已经在Postgres数据库中创建了一个物化视图。当我创建到该Postgres数据库的微策略多维数据集连接时,无法看到该物化视图。
有人可以帮助我了解为什么我看不到这个东西吗?
谢谢
答案 0 :(得分:1)
您需要编辑“仓库目录”的读取设置。 位置:模式->仓库目录选项->目录->读取设置
查询表格:
SELECT n.nspname as NAME_SPACE,
c.relname as TAB_NAME
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind in ('v', 'm', 'r', 'p', '')
AND n.nspname <> 'pg_catalog'
AND n.nspname <> 'information_schema'
AND n.nspname !~ '^pg_toast'
ORDER BY 1,2
列查询: 挂在表INFORMATION_SCHEMA.COLUMNS上的LEFT JOIN上(到目前为止,对我来说还没有问题)
SELECT DISTINCT
nspname AS NAME_SPACE,
relname AS TAB_NAME,
attname AS COL_NAME,
typname AS DATA_TYPE,
COALESCE(B.CHARACTER_MAXIMUM_LENGTH, attlen) AS DATA_LEN,
NUMERIC_PRECISION AS DATA_PREC,
NUMERIC_SCALE AS DATA_SCALE
FROM
pg_attribute A
JOIN
pg_class C
ON
A.attrelid = C.oid
JOIN
pg_namespace N
ON
C.relnamespace = N.oid
JOIN
pg_type T
ON
A.atttypid = T.oid
LEFT OUTER JOIN
INFORMATION_SCHEMA.COLUMNS B
ON
A.attname = B.COLUMN_NAME
AND C.relname = B.TABLE_NAME
AND N.nspname = B.TABLE_SCHEMA
WHERE
relname IN (#TABLE_LIST#)
AND attnum > 0
ORDER BY
1,
2,
3
特别是可以改进列查询,但是直到现在我还没有回过头,因为它可以正常工作。
所有这些原因可以在以下讨论中找到:Materialized views don't show up in information_schema。
答案 1 :(得分:0)
为此找到了解决方法...
您可以将视图创建为标准视图,将其连接到Microstrategy,然后删除该视图并创建为实体化视图。然后,只要您保持相同的名称,就会选择新创建的实体化视图。