2014-01-10 20 views
0

我想從另一個postgress數據庫(9.1.7)導入一個表格到我的(9.1.11)。我試圖導入轉儲,但我得到了一堆語法錯誤,我假設版本不匹配有一些問題?pg_dump從9.1.7到9.1.11

是否有更好的解決方案,而不是降級我的postgress安裝以匹配所需的輸入文件?

這是我用來將數據庫中導出的9.1.7系統上的命令:

pg_dump superdb -U tester -a -t guidedata > /tmp/guidedata.sql 

這是我用來導入轉儲文件guidedata.sql

psql linuxdb -U tester -h localhost < guidedata.sql 

此命令是我試圖導入的數據庫轉儲文件的頂部:

-- 
-- PostgreSQL database dump 
-- 

SET statement_timeout = 0; 
SET client_encoding = 'UTF8'; 
SET standard_conforming_strings = on; 
SET check_function_bodies = false; 
SET client_min_messages = warning; 

SET search_path = public, pg_catalog; 

-- 
-- Data for Name: epg; Type: TABLE DATA; Schema: public; Owner: spy 
-- 

COPY epg (id, channel, sdate, stime, duration, stitle, ltitle, theme, sdesc, ldesc, mpaa, rating, stereo, surround, sap, closedcaptioned, animated, blackwhite, rerun, live, ismovie, nudity, language, violence, adulttheme, halfstars, field1) FROM stdin; 
90056520  AMC  01092014  0100 270  Titanic Titanic 8,15 A woman falls for an artist aboard the ill-fated ship. Leonardo DiCaprio, Kate Winslet (1997) A society girl abandons her haughty fiance for a penniless artist on the ill-fated ship's maiden voyage. (3:15) MPAAPG13  TVPG f  f  f  t  f  f  t  f  t  t  t  t  t  8  f 
90056521  AMC  01092014  0530 180  Love Actually Love Actually 23,15 Various people deal with relationships in London.  Hugh Grant, Laura Linney (2003) A prime minister, an office worker, a pop star, a jilted writer, married couples and various others deal with relationships in London. (2:15) MPAAR TVPG f  f  t  t  f  f  t  f  t  t  t  f  t  6  f 
90056522  AMC  01092014  0830 150  Four Four Weddings and a Funeral  23,15 An English charmer meets a lusty American.  Hugh Grant, Andie MacDowell (1994) An English charmer and a lusty American make love over a course of surprising events. (1:56) MPAAR TV14 f  f  t  t  f  f  t  f  t  f  t  f  t  7  f 
90056523  AMC  01092014  1100 30  Paid Prog.  Paid Programming  0  Paid programming.  Paid programming.      f  f  f  f  f  f  t  f  f  f  f  f  f  0  f 
90056524  AMC  01092014  1130 30  Williams  Montel Williams 19  Living well with Montel and the effects of identity theft.  Living well with Montel and the devastating effects of identity theft.     f  f  f  f  f  f  t  f  f  f  f  f  f  0  f 
90056525  AMC  01092014  1200 30  Cindy Crawford Cindy Crawford Reveals Secret to Ageless Beauty 19  Cindy Crawford's skin secret with Meaningful Beauty. Cindy Crawford's supermodel secret to youthful, radiant-looking skin with Meaningful Beauty.     f  f  f  f  f  f  t  f  f  f  f  f  f  0  f 
90056526  AMC  01092014  1230 30  More Sex  More Sex, Less Stress 19  Androzene promotes male sexual health & nourishes the body.  Androzene promotes male sexual health and nourishes the body.     f  f  f  f  f  f  t  f  f  f  f  f  f  0  f 
90056527  AMC  01092014  1300 30  WEN Hair Care WEN by Chaz Dean Revolutionary Hair Care System 19  WEN by Chaz Dean is revolutionary hair care. WEN by Chaz Dean is revolutionary hair care that cleans and conditions without many shampoo's harsh detergents or sulfates. Natural ingredients help make hair shinier, fuller, softer and more manageable! By trusted GuthyRenker.      f  f  f  f  f  f  t  f  f  f  f  f  f  0  f 
90056528  AMC  01092014  1330 30  Medicare  Looking for a Medicare plan? Tune in now!  19  Watch and learn about Humana Medicare Advantage plans. Watch and learn about Humana Medicare Advantage plans.     f  f  f  f  f  f  t  f  f  f  f  f  f  0  f 
90056529  AMC  01092014  1400 5  Stooges The Three Stooges  6  The caveman boys meet cavewomen.  Moe Howard, Larry Fine ''I'm a Monkey's Unc 

這是一些錯誤輸出我在控制檯上看到試圖導入時:

ERROR: syntax error at or near "Route" 
LINE 1: Route 66 renovation gives Ron a change of heart. TVPG t f f... 
     ^
ERROR: syntax error at or near "Ron" 
LINE 1: Ron and Jason bring out the Pontiac GTO. TVPG t f f t f f t... 
     ^
ERROR: syntax error at or near "repairing" 
LINE 1: repairing the clutch and drive shaft on the 1995 BMW. TVPG ... 
     ^
ERROR: syntax error at or near "classic" 
LINE 1: classic Bucik; 

感謝

+1

這可能不是轉儲。你能發表第一行嗎?你是如何產生轉儲的,你如何導入它? – leonbloy

+0

嘿,謝謝,我只是添加了我用於導入/導出的命令和導入文件的標題,如果其他東西會有用,請告訴我,我將添加它 – Hoofamon

+0

@Hofofon任何您複製並粘貼轉儲的機會一些可能已將標籤轉換爲空格或以其他方式破壞轉儲的工具? –

回答

0

我的猜測 - 一個系統是Linux/UNIX/Mac上,另一個是Windows操作系統。

這是抱怨數據塊的第一行,因爲有一個流浪的回車(\ r)字符。

解決方案:使用dump命令中的-Fc--format=custom(使用推薦的,除非您有充分理由不要)「自定義」格式。這應該排序。