2016-07-22 31 views

回答

2

第一

gpadmin=# create schema foo; 
gpadmin=# create schema bar; 

然後創建模式的外部表創建模式

gpadmin=# CREATE EXTERNAL TABLE foo.fre2(
ngram text, 
year int4, 
match_count int4, 
page_count int4, 
volume_count int4) 
LOCATION ('gpfdist://mdw:8080/dat.txt') 
FORMAT 'TEXT' (DELIMITER E'\t') 
LOG ERRORS INTO load_e_fre2 SEGMENT REJECT LIMIT 500 rows; 

gpadmin=# CREATE EXTERNAL TABLE bar.fre2(
ngram text, 
year int4, 
match_count int4, 
page_count int4, 
volume_count int4) 
LOCATION ('gpfdist://mdw:8080/dat.txt') 
FORMAT 'TEXT' (DELIMITER E'\t') 
LOG ERRORS INTO load_e_fre2 SEGMENT REJECT LIMIT 500 rows; 

你應該能夠看到各自的命名空間

gpadmin=# select c.relnamespace, c.relname, e.* from pg_class c join pg_exttable e on e.reloid = c.oid where c.relname = 'fre2'; 
relnamespace | relname | reloid |   location   | fmttype |    fmtopts     | command | rejectlimit | rejectlimittype | fmterrtbl | encoding | writable 
--------------+---------+--------+------------------------------+---------+----------------------------------------+---------+-------------+-----------------+-----------+----------+---------- 
2200 | fre2 | 57474 | {gpfdist://mdw:8080/dat.txt} | t  | delimiter '  ' null '\N' escape '\' |   |   500 | r    |  49164 |  6 | f 
57403 | fre2 | 57500 | {gpfdist://mdw:8080/dat.txt} | t  | delimiter '  ' null '\N' escape '\' |   |   500 | r    |  49164 |  6 | f 
57404 | fre2 | 57526 | {gpfdist://mdw:8080/dat.txt} | t  | delimiter '  ' null '\N' escape '\' |   |   500 | r    |  49164 |  6 | f 
(3 rows) 


gpadmin=# select nspname from pg_namespace where oid in (2200, 57403, 57404); 
nspname 
--------- 
public 
foo 
bar 
(3 rows) 
+0

它不適用於我,我的上一張桌子消失..在不同的架構下使用相同的表名稱不能存在於我的條件中...我已更新我的問題,你可以檢查它看到更多的細節 – Rocke

0

以下消息是存在的表不是根據前綴「通知」的錯誤它只是通知用戶錯誤表在CREATE語句中定義不存在,因此它正在爲您創建該表。

Notice: Error table "request_histories_external_error" does not exist. Autogenerating and error table with the same name 
相關問題