I was recreating my database with fresh test data, so I dropped / created it.
I installed Postgres 16 / postGIS 3 successfully on Ubuntu 22.04 a month ago, but then after I dropped my database, the postgis extension wouldn't recreate with the error below.
# CREATE EXTENSION postgis;
ERROR: could not find function "lwgeom_neq" in file postgis-3.so
I Googled this error and came up empty.
I tried uninstalling/reinstalling postgis from the Ubuntu packages using apt, but this did not solve the problem
I was recreating my database with fresh test data, so I dropped / created it.
I installed Postgres 16 / postGIS 3 successfully on Ubuntu 22.04 a month ago, but then after I dropped my database, the postgis extension wouldn't recreate with the error below.
# CREATE EXTENSION postgis;
ERROR: could not find function "lwgeom_neq" in file postgis-3.so
I Googled this error and came up empty.
I tried uninstalling/reinstalling postgis from the Ubuntu packages using apt, but this did not solve the problem
Only after installing the latest FROM THE POSTGIS REPO did it work again, following steps in https://brightwhiz.com/how-to-install-the-latest-postgis-on-ubuntu-22-04/
Step 1: Update Your System It’s always a good practice to ensure your system is up to date before installing any new software. Open a terminal and run the following commands:
$ sudo apt update $ sudo apt upgrade This will update the package lists and upgrade any existing packages to their latest versions.
Step 2: Install PostgreSQL PostGIS is an extension for PostgreSQL, so you’ll need to have PostgreSQL installed. If it’s not already on your system, you can install it with the following command:
$ sudo apt install postgresql postgresql-contrib Step 3: Install PostGIS Now that PostgreSQL is installed, you can proceed to install PostGIS. Ubuntu 22.04’s default repositories may not always have the latest version of PostGIS, but you can use the PostgreSQL apt repository to get the most recent version. Here’s how:
3.1: Add the PostgreSQL Repository $ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' 3.2: Import the Repository Signing Key $ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - 3.3: Install PostGIS Now, update the package list again and install PostGIS:
$ sudo apt update $ sudo apt install postgis postgresql--postgis- Replace with the specific PostgreSQL and PostGIS versions you want to install. For example, for PostgreSQL 14 and PostGIS 3, use:
$ sudo apt install postgis postgresql-14-postgis-3 Step 4: Create a PostGIS-enabled Database Once PostGIS is installed, you can create a new PostgreSQL database and enable PostGIS in it. Replace <your_database> with your desired database name:
$ sudo -u postgres createdb <your_database> $ sudo -u postgres psql -d <your_database> -c "CREATE EXTENSION postgis;" Step 5: Verify the Installation To ensure that PostGIS is installed correctly and functioning, you can connect to your PostGIS-enabled database and run a simple query:
$ sudo -u postgres psql -d <your_database> Inside the PostgreSQL prompt, run the following query:
SELECT postgis_version();