Postgresql 从9.1.7至9.1.11的pg_转储
我想从另一个postgress数据库(9.1.7)导入一个表到我的数据库(9.1.11)。我试图导入转储文件,但是我得到了一堆语法错误,我假设版本不匹配有一些问题 除了降级我的postgress安装以匹配所需的输入文件之外,还有更好的解决方案吗 这是我用于在9.1.7系统上导出数据库的命令:Postgresql 从9.1.7至9.1.11的pg_转储,postgresql,pg-dump,Postgresql,Pg Dump,我想从另一个postgress数据库(9.1.7)导入一个表到我的数据库(9.1.11)。我试图导入转储文件,但是我得到了一堆语法错误,我假设版本不匹配有一些问题 除了降级我的postgress安装以匹配所需的输入文件之外,还有更好的解决方案吗 这是我用于在9.1.7系统上导出数据库的命令: pg_dump superdb -U tester -a -t guidedata > /tmp/guidedata.sql 这是我用来导入转储文件guidedata.sql的命令 psql lin
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;
谢谢我猜-一个系统是linux/unix/mac,另一个是Windows 它抱怨数据块的第一行,因为有一个杂散的回车符(\r)
解决方案:在dump命令上使用带有
-Fc
或--format=custom
的“自定义”格式(除非您有充分理由不这样做,否则建议使用)。这应该可以排序。那可能不是垃圾场。你能发第一行吗?您是如何生成转储文件以及如何导入它的?嘿,谢谢,我刚刚添加了用于导入/导出的命令以及导入文件的标题,如果还有什么有用的,请告诉我,我会补充it@Hoofamon您是否有可能使用一些工具复制并粘贴了转储文件,这些工具可能已将选项卡转换为空格或以其他方式损坏了转储文件?这些命令在我看来是正常的,但我看不出与错误消息有任何关系。您确定它是相同的guidedata.sql
文件吗?如果你通过了第一行会发生什么head-n14 | psql linuxdb-U tester-h localhost
?还要检查控制台错误表的第一行(您可以将它们重定向到文件)。并检查您的权限是否正常,请参阅