Until now the default schema was empty and the PostgreSQL search path
was used to find tables etc.
We now set the default schema for the middle and the pgsql and flex
outputs to 'public'.
This simplifies the code, because we don't have to handle the case
without schema specially any more. More importantly it makes it easier
for the user to reason about what osm2pgsql is doing, because it does
not depend on the setting of the search path in the PostgreSQL session.
This fixes a problem where osm2pgsql could not find the
osm2pgsql_properties table it created itself, because it was created in
a different schema than expected (#2010).
The behaviour of the gazetteer output has not changed. It still uses
unqualified names.
This will be a breaking change for those users who rely on the old
behaviour.
Fixes#2010, #2011.
Prepared statements can now send parameters in binary as well as in the
default text format. To do this, wrap the binary data in an instance of
the binary_param class, which is just a wrapper of std::string_view used
to signal to the exec_prepared() function that this parameter should be
sent in binary.
You can mix and match any number of parameters in text or binary format.
It isn't possible any more to use exec_prepared() without any
parameters, but that wasn't use (and doesn't make much sense anyway), so
no loss there.
This removes the pg_conn_t::query() in favour of the pg_conn_t::exec()
function. They mostly did the same thing anyway and it was always
confusing when to use which one and how to set the "expect" parameter.
Now we have exec() and exec_prepared() as the only functions running a
SQL command and returning the results.
There were several places (pgsql.hpp, pgsql-capabilities.hpp,
db-check.hpp) that had code to check various capabilities, version
numbers etc. of the database we are connected to. This is now
consolidated in pgsql-capabilities.hpp. It needs to be initialized once
at program start by calling init_database_capabilities() with a database
connection object. Checking version numbers or capabilities is then much
easier, because no active database connection is needed any more.
This also adds code to get the list of supported index methods from the
database which we will need shortly. (Only works with PostgreSQL >9.5.)
This adds a copyright notice to all C++ files and the README clarifying
the license. (There is no change of the license.) This also removes a
few names explicitly mentioned as copyright holders, instead refering to
the git log which has a full list of all osm2pgsql developers. (There is
also still the AUTHORS file which names the most important developers.)
The only exception is the sprompt.cpp file which was taken from
PostgreSQL and keeps its original license information (and, of course,
the files in contrib).
This completes the schema support for the flex output.
You have to define a schema before using it. osm2pgsql might not have
the needed permissions for creating a schema, so it will not try to
create it.