恢復 postgres 轉儲給出錯誤:類型不存在

恢復 postgres 轉儲給出錯誤:類型不存在

我從一台舊的 Ubuntu 機器上轉儲了一個資料庫,其中包含 postgresql 8.4 和 postgis 1.5。在新的 ubuntu 12.04 上,我安裝了 Postgresql 9.1 和 postgis 1.5。 (使用postgis.sql和spatial_ref_sys.sql建立postgis_template)。

當我在新機器上恢復轉儲時,資料已構建,但我收到 25 個錯誤訊息,如下所示

...    

pg_restore: [archiver (db)] Error from TOC entry 711; 1255 18533 FUNCTION gidx_in(cstring) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  function public.gidx_in(cstring) does not exist
    Command was: DROP FUNCTION public.gidx_in(cstring);

pg_restore: [archiver (db)] Error from TOC entry 34; 1255 17743 FUNCTION geometry_send(geometry) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  type "geometry" does not exist
    Command was: DROP FUNCTION public.geometry_send(geometry);

pg_restore: [archiver (db)] Error from TOC entry 33; 1255 17742 FUNCTION geometry_recv(internal) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  function public.geometry_recv(internal) does not exist
    Command was: DROP FUNCTION public.geometry_recv(internal);

pg_restore: [archiver (db)] Error from TOC entry 31; 1255 17740 FUNCTION geometry_out(geometry) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  type "geometry" does not exist
    Command was: DROP FUNCTION public.geometry_out(geometry);

pg_restore: [archiver (db)] Error from TOC entry 30; 1255 17739 FUNCTION geometry_in(cstring) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  function public.geometry_in(cstring) does not exist
    Command was: DROP FUNCTION public.geometry_in(cstring);

pg_restore: [archiver (db)] Error from TOC entry 709; 1255 18529 FUNCTION geography_out(geography) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  type "geography" does not exist
    Command was: DROP FUNCTION public.geography_out(geography);

任何人都可以解釋發生了什麼事嗎?我可以忽略這些錯誤嗎?

謝謝!親切的問候,

東尼

答案1

你有多個錯誤。需要仔細閱讀它們,然後閱讀您的轉儲文件(找到上面錯誤中引用的行,並確定發生這些錯誤的位置是否是一個嚴重的問題,或者您可以忽略的問題)--我們我們無法告訴您這一點,因為我們真的不知道您的環境中什麼是重要的。

從我在錯誤訊息中看到的情況來看,您的轉儲檔案似乎DROP在實際加載資料之前嘗試清理舊的資料庫內容(函數、類型和表),因此,如果您要恢復到沒有現有資料的系統,當它嘗試刪除不存在的物件時會收到錯誤。
如果發生這種情況,您可能不必擔心錯誤(儘管您可能希望在沒有“清理”命令的情況下進行轉儲以供將來使用,這樣您就不會收到它們 - 請參閱pg_dump手冊頁有關如何執行此操作的資訊)。

現在,如果您在建立函數/流程時開始遇到錯誤,這些錯誤很可能很嚴重,需要調查和修正。

相關內容