restore table exported with pg_dump from within livecode?

Dr. Hawkins dochawk at gmail.com
Thu Feb 16 19:22:50 EST 2017


I have a table that I want each customer to get as a starting point
(abbreviations for creditors)>

I've tried exporting with pg_dump for only the table

/Library/PostgreSQL/9.5/bin/pg_dump -t stockabrevs -f abrev_bkp.sql
-Udhadmin dhbk_dbtrs


I then use this within a script,

put "BEGIN TRANSACTION;" & cr & url
"file:~/Documents/dhbk/dflt_fls/abrev_bkp.sql" & cr & "END TRANSACTION;" &
cr into dcmd

revExecuteSql dbUsrDbNo, dcmd


This, however, gives me

ERROR: syntax error at or near "scum"

LINE 232: scum \N \N S f f f f the scummiest lending company under t...

^

The relevant section of the dumped file seems to be

--

-- Data for Name: stockabrevs; Type: TABLE DATA; Schema: public; Owner:
dhadmin

--


COPY stockabrevs (abrev, usr, tstmp, chrtype, unliq, disp, cont, codbt,
cd_adr, rpinterest, cname, cadr, ijkey, due, acctno, pmt, reason, prtype,
npramount, hwjc, asset, value, atype, exemption_1, exval_1, scintent,
exemption_2, exval_2, exemption_3, exval_3, arrears, pmtsleft, pmtmt,
incins, inctax, unsecprt, gsl, parentdna, dpnddna, contact, prtyp, extyp_1,
extyp_2, extyp_3, dfl_exval_1, dfl_exval_2, dfl_exval_3, dfl_pmtmt,
dfl_unsecprt, dflcrd, dflcrdchps, claimno, claimamt, pramount, dodbt,
intexpl, intent, exempt, cecfeml, srv704, srvecf, srvinc, arint, cpmtstr,
grtottrpy, othvals, arint1, armnt1, arpmt1, arstr1, conduit, dfl_arint1,
dfl_armnt1, dfl_arpmt1, dfl_arstr1, dfl_grtotdbpy, dfl_grtottrpy,
dfl_p13_value, dfl_scint1, dfl_scint2, dfl_scmnt1, dfl_scmnt2, dfl_scpmt1,
dfl_scpmt2, dfl_scstr1, dfl_scstr2, grtotdbpy, p13_value, scint1, scint2,
scmnt1, scmnt2, scpmt1, scpmt2, scstr1, scstr2, cpmtmnt, dfl_cpmtmnt,
dfl_cpmtstr, dfl_matdate, matdate, p13_pstpetpby, rate, cg_chrtype,
ck_codbt, ck_cont, ck_disp, ck_exempt, ck_gsl, ck_incins, ck_inctax,
ck_srv704, ck_srvecf, ck_srvinc, ck_unliq, dfl_p13_pstpetpby, othvals2,
setoff, dfl_pramount, totliens, dfl_totliens, dat1, dat2, leased, linnodbt,
valuetot, dfl_valuetot, dfl_linnodbt, dfl_linnumdbt, linnumdbt,
dfl_linnoast, linnoast, prothexp, prtypexp, asubtype, unstyp, unstypexp,
dat3, dat4, dbtcp, dfl_exvaltot, dfl_linnoxmp, exvaltot, linnoxmp, xmpmax,
bnfnsdr, dfl_prfpydats, dfl_totpref, paynsdr, prfpydats, prfsofa, prftyp,
prftypexp, totpref, dfl_prfpydat1, prfpydat1, prfpydat2, prfpydat3,
atypeexp, astoinfo, dfl_insbnfpmtexp, dfl_inspmtexp, dfl_linnomtr,
dfl_propszedscr, dfl_propszeval, dfl_rpinterest, dfl_value, insbnfpmtexp,
inspmtexp, linnomtr, propszedat, propszedscr, propszeval, sctypexp,
dfl_prfpmtexp, dfl_prftypexp, prfpmtexp, dfl_prftot, prftot, pardnatyps,
dfl_parlinnosec, dfl_parlinnouns, parlinnosec, parlinnouns,
dfl_paractnosec, paractnosec, dfl_paractnouns, paractnouns, setoff90,
sftyp, dat5, exlbl_1, exlbl_2, exlbl_3) FROM stdin;


And line 232 is

scum    \N      \N      S       f       f       f       f
    the scummiest lending company   under the bridge with the trolls\nAmes,
IA  50010       mrt1    \N              \N      \nFirst mortgage on primary
residence           \N                      \N      R       NRS 21.090(l)
\N                      \N              \N      \N      \N      \N      f
    f       8000000 f       \N              \N      \N      \N      \N
\N      \N      \N      \N      \N      \N      \N      \N      \N      \N
    \N      \N      \N      \N      \N      \N      \N      \N      \N
\N      \N      \N      \N      \N      \N      \N      \N      \N      \N
    \N      \N      \N      \N      \N      \N      \N      \N      \N
\N      \N      \N      \N      \N      \N      \N      \N      \N      \N
    \N      \N      \N      \N      \N      \N      \N      \N      \N
\N      \N      \N      \N      \N      \N      \N      \N      \N      \N
    \N      \N      \N      \N      \N      \N      \N      \N      \N
\N      \N      \N      \N      \N      \N      \N      \N      \N      \N
    \N      \N      \N      \N      \N      \N      \N      \N      \N
\N      \N      \N      \N      \N      \N      \N      \N

\N      \N      \N      \N      \N      \N      \N      \N      \N      \N
    \N      \N      \N      \N      \N      \N      \N      \N      \N
\N      \N      \N      \N      \N      \N      \N      \N      \N      \N
    \N      \N      \N      \N      \N      \N      \N      \N      \N
\N      \N      \N      \N      \N      \N      \N      \N      \N      \N



This doesn't look right to me; I had thought that I should have a file with
CREATE and a bunch of INSERTs.

Am I using pg_dump wrong?


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462



More information about the use-livecode mailing list