2
對於一般的表和視圖,我可以通過運行下面的查詢看到自己的數據類型:物化視圖的列數據類型?
select data_type from information_schema.columns
where .....
然而,它似乎並不認爲有關的任何信息物化視圖出現在這裏。
我能夠運行得到了物化視圖的列的列表:
SELECT
a.attname as column_name
FROM
pg_catalog.pg_attribute a
INNER JOIN
(SELECT c.oid,
n.nspname,
c.relname
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relname ~ ('^(materializedview)$')
AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 2, 3) b
ON a.attrelid = b.oid
INNER JOIN
(SELECT
a.attrelid,
max(a.attnum) as max_attnum
FROM pg_catalog.pg_attribute a
WHERE a.attnum > 0
AND NOT a.attisdropped
GROUP BY a.attrelid) e
ON a.attrelid=e.attrelid
WHERE a.attnum > 0
AND NOT a.attisdropped
ORDER BY a.attnum
不過,我一直無法弄清楚,如果我能確定基礎列/數據類型是什麼。
有沒有辦法查看這些信息?