1

I'm following along with PostGIS in Action, 2nd ed., chapter 11, while attempting the SQL dump from the data files and I'm getting the following error:

ERROR:  syntax error at or near "1"
LINE 189: 1 0101000020E610000060C77F81A01E6340132C0E677E293BC0 0 0 0 4... 

I've already looked at the errata, google, PostgresSQL docs (9.2, 9.5 copy differences); and double checked tab separated in relation to the stdin.

--
-- PostgreSQL database dump
--

-- Dumped from database version 9.2.4
-- Dumped by pg_dump version 9.3beta2

TOC entry 3966 (class 0 OID 10834271)
-- Dependencies: 342
-- Data for Name: aussie_track_points; Type: TABLE DATA; Schema: ch11; Owner: postgres
--

COPY aussie_track_points (ogc_fid, geom, track_fid, track_seg_id, track_seg_point_id, ele, "time", course, speed, magvar, geoidheight, name, cmt, "desc", src, url, urlname, sym, type, fix, sat, hdop, vdop, pdop, ageofdgpsdata, dgpsid) FROM stdin;
-- 1    0101000020E610000060C77F81A01E6340132C0E677E293BC0  0   0   040.899999999999999 2009-07-18 04:30:00-04  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  3d  \N  0.96999999999999997 2.1699999999999999  2.3799999999999999  \N  \N
-- 2    0101000020E61000000723F609A01E6340F51263997E293BC0  0   0   1   40.399999999999999  2009-07-18 04:30:14-04  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  3d  \N  0.91000000000000003 0.88    1.27    \N  \N
-- 3    0101000020E6100000A9C1340C9F1E6340E7C8CA2F83293BC0  0   0   2   41.799999999999997  2009-07-18 04:30:20-04  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  3d  \N  0.96999999999999997 1.8999999999999999  2.1299999999999999  \N  \N
-- 4    0101000020E610000038DBDC989E1E6340B610E4A084293BC0  0   0   3   41.299999999999997  2009-07-18 04:30:26-04  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  3d  \N  0.91000000000000003 0.88    1.27    \N  \N
-- 5    0101000020E6100000020D36759E1E6340F52F49658A293BC0  0   0   4   41.299999999999997  2009-07-18 04:30:43-04  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  \N  3d  \N  0.91000000000000003 0.88    1.27    \N  \N
  • When are you getting this error? When you try and restore from the dump? How exactly are you doing that? Give the commands - I suspect its because PostgreSQL has a different idea of what stdin is at that point... – Spacedman Jan 22 '16 at 13:50
  • I was attempting to load the file using the SQL editor, which had worked for all the previous files. I was able to solve the problem by using psql. Thanks for the effort.... – PDX Jan 22 '16 at 14:18
1

Solution:

1) Use psql in the command line instead of loading with the SQL editor. 2) If you're using Windows and not logged in as postgres, add the -U flag to: psql -d postgis_in_action -U postgres -f ..path/ch11_data.sql -- for some reason, the username is not being picked up from the pgpass.conf file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.