Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing error when postigs extension is missing #1400

Closed
lonvia opened this issue Jan 29, 2021 · 3 comments · Fixed by #1401
Closed

Confusing error when postigs extension is missing #1400

lonvia opened this issue Jan 29, 2021 · 3 comments · Fixed by #1401

Comments

@lonvia
Copy link
Collaborator

lonvia commented Jan 29, 2021

When running osm2pgsql without naming a database via -d or PGDATABASE, then the version check prints a rather confusing message:

me@machine:~$ ./osm2pgsql -S ../default.style ~/osm/data/liechtenstein-latest.osm.pbf 
2021-01-29 17:54:41  osm2pgsql version 1.4.0 (1.4.0-82-gfd9c0c33)
2021-01-29 17:54:41  Database version: 11.9 (Debian 11.9-0+deb10u1)
2021-01-29 17:54:41  ERROR: Database error: ERROR:  function postgis_lib_version() does not exist
LINE 1: SELECT regexp_split_to_table(postgis_lib_version(), '\.')
                                     ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

The same happens when the database is right but the postgis extension is missing. We should print a more helpful message here.

@pnorman
Copy link
Collaborator

pnorman commented Jan 29, 2021

What database is it connecting to?

@stephankn
Copy link

Do I understand correctly, that the request is to first check whether the postgis extension is installed, before calling postgis functions?

Like:

postgres=# SELECT count(*) FROM pg_extension WHERE extname='postgis';
 count
-------
     1
(1 row)

And if not printing an error message?

@lonvia lonvia changed the title Confusing error when database parameter is missing Confusing error when postigs extension is missing Jan 29, 2021
joto added a commit to joto/osm2pgsql that referenced this issue Jan 29, 2021
@lonvia
Copy link
Collaborator Author

lonvia commented Jan 29, 2021

What database is it connecting to?

It was connecting to a database under my username, which happened to exist. Issue title fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants