Skip to content

Issues with existing schema or insufficient schema creation priviledges #5

@cgauvi

Description

@cgauvi

Thanks for the work, this is a useful tool.

Problem

Code fails with the following error if 1.user does not have schema creation rights or 2.the specified schema xxxx already exists

Executing SQL: 'create schema xxxx'
Error setting up gtfs schema

This comes from run_sql(conn, "create schema %s", arguments.schema)

By the way , the hard coded error message Error setting up gtfs schema is confusing since it does not change if a schema is specified

Removing that statement and passing in a valid existing schema works as expected.

To Reproduce

gtfs2pgrouting -d $dbname \
 -u $user \
 -p $password \
 -H $host \
 -P $port \
 -s xxxx \
 -t 'folder' \
 -v \
 data/gtfs

with existing xxxx schema

Expectation

I expect the code not to try to create the schema if it already exists. At least setting run_sql(conn, "create schema IF NOT EXISTS %s", arguments.schema) would be better, but this still fails if the user doesn't have proper access. I suggest simply removing this statement and sending out an error if the schema does not exist and asking the user to create if if desired.

Platform/versions

SELECT version(); 
SELECT postgis_full_version();
SELECT pgr_version(); 

PostgreSQL 16.8 on aarch64-unknown-linux-gnu, compiled by aarch64-unknown-linux-gnu-gcc (GCC) 10.5.0, 64-bit

POSTGIS="3.5.1 0" [EXTENSION] PGSQL="160" GEOS="3.13.0-CAPI-1.19.0" PROJ="9.5.0 GDAL="GDAL 3.9.3, released 2024/10/07" LIBXML="2.12.5" LIBJSON="0.15.99" LIBPROTOBUF="1.3.0" WAGYU="0.5.0 (Internal)"

pgr_version: 3.6.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions