Opened 10 years ago

Closed 10 years ago

#2644 closed enhancement (duplicate)

pgsql2shp error on streaming replica: cannot execute CREATE TABLE AS in a read-only transaction

Reported by: dfuhry Owned by: mcayland
Priority: medium Milestone: PostGIS 2.2.0
Component: utils/loader-dumper Version: 2.1.x
Keywords: Cc:

Description

pgsql2shp when run against a PostgreSQL streaming replica gives output:

Initializing... 
Error executing user query: ERROR:  cannot execute CREATE TABLE AS in a read-only transaction

because streaming replicas are read-only and cannot execute mutable queries like CREATE TEMP TABLE in the ShpDumperOpenTable function in pgsql2shp-core.c.

A fix would be to instead of creating a temp table, PQexec the query, read data types from the PGresult, and compute field widths by scanning the result, something like how psql does in the printQuery and print_aligned_text methods in Postgres' psql/print.c.

Change History (5)

comment:1 by robe, 10 years ago

Milestone: PostGIS 2.1.2PostGIS 2.2.0
Type: defectenhancement

comment:2 by dfuhry, 10 years ago

A related ticket is #2045 which laments that pgsql2shp fails when the exporting database user does not have permission to create a temp table, and proposes a GSoC.

comment:3 by robe, 10 years ago

dfuhry sounds good. The problem is that no one in PostGIS dev group is interested in mentoring except possibly strk and even he I don't think is all that interested.

You wanna be a mentor :)

I've changed title of GSOC page to 2014 since all these are still open and Voronoi is partially closed.

http://trac.osgeo.org/postgis/wiki/GoogleSummerCode

comment:4 by robe, 10 years ago

I put us live on the OSGeo page. http://wiki.osgeo.org/wiki/Google_Summer_of_Code_2014_Ideas#OSGeo_Foundation_member_projects

I guess if any students are interested in pgsql2shp stuff I know it well enough to fill somewaht comfortable mentoring it and we do have other tickets for that I'll tag.

comment:5 by robe, 10 years ago

Resolution: duplicate
Status: newclosed

As noted this is a duplicate of #2045

Note: See TracTickets for help on using tickets.