Table
Redshift:可以在 information_schema.columns 中找到表列,但在 pg_catalog.pg_table_def 中找不到
我在 Redshift 中創建了一個表。當我嘗試搜尋表定義時,我
information_schema.columns
通過執行以下查詢來獲取結果:select * from information_schema.columns where table_name = 'table' and table_schema='schema'
但是,當我對 執行查詢時
pg_catalog.pg_table_def
,我沒有得到任何結果。select * from pg_catalog.pg_table_def where tablename = 'table' and schemaname = 'schema'
誰能幫我理解為什麼會這樣?該表由我正在使用的帳戶創建並擁有。
檢查
show search_path;
以確保您位於創建表的目前路徑上。如原始 AWS 紅移文件所述。PG_TABLE_DEF 僅返回有關使用者可見的表的資訊。
為了得到你想要的,你應該跑
set search_path to '$user', '<#your_schema#>'; select * from pg_catalog.pg_table_def where tablename = '<#your_table#>';
希望有幫助。