[postgis-devel] [PostGIS] #1197: Newlines in shapefiles not handled correctly by shp2pgsql
PostGIS
trac at osgeo.org
Fri Sep 16 05:48:09 PDT 2011
#1197: Newlines in shapefiles not handled correctly by shp2pgsql
-------------------------------+--------------------------------------------
Reporter: dmiranda | Owner: mcayland
Type: defect | Status: new
Priority: high | Milestone: PostGIS 2.0.0
Component: postgis | Version: trunk
Keywords: newline shp2pgsql |
-------------------------------+--------------------------------------------
Changes (by mcayland):
* owner: pramsey => mcayland
Comment:
I'm afraid I can't reproduce this here as the following file works under
plain PostgreSQL for me:
postgres at zeno:~$ cat /tmp/mca.sql
SET CLIENT_ENCODING TO UTF8;
SET STANDARD_CONFORMING_STRINGS TO ON;
BEGIN;
CREATE TABLE "newline" (gid serial,
"id" numeric(10,0),
"content" varchar(80));
ALTER TABLE "newline" ADD PRIMARY KEY (gid);
INSERT INTO "newline" ("id","content") VALUES ('1','bla
bla
bla');
COMMIT;
postgres at zeno:~$ psql -d foo -f /tmp/mca.sql -U foo -h localhost
Password for user foo:
SET
SET
BEGIN
psql:/tmp/mca.sql:6: NOTICE: CREATE TABLE will create implicit sequence
"newline_gid_seq" for serial column "newline.gid"
CREATE TABLE
psql:/tmp/mca.sql:7: NOTICE: ALTER TABLE / ADD PRIMARY KEY will create
implicit index "newline_pkey" for table "newline"
ALTER TABLE
INSERT 0 1
COMMIT
postgres at zeno:~$ psql -d foo -U foo -h localhost
Password for user foo:
psql (8.4.8)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.
foo=> select * from newline;
gid | id | content
-----+----+---------
1 | 1 | bla
: bla
: bla
(1 row)
The use of standard_conforming_strings should be enough so that multi-line
INSERT statements are accepted correctly without having to escape anything
other than as dictated by the SQL standard.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/1197#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-devel
mailing list