geometry does not exist PGsql
时间: 2023-09-26 22:13:36 浏览: 96
In PostgreSQL, the "geometry" data type does not exist by default. However, PostgreSQL supports spatial data through the extension called "PostGIS."
To use geometric data types and functions in PostgreSQL, you need to install and enable the PostGIS extension. Here are the steps to follow:
1. Install PostGIS:
- On Ubuntu: `sudo apt-get install postgis`
- On macOS with Homebrew: `brew install postgis`
- On Windows, you can download the installer from the PostGIS website.
2. Enable the PostGIS extension:
- Connect to your PostgreSQL database using a client like `psql`.
- Run the following SQL command to enable the PostGIS extension:
```
CREATE EXTENSION postgis;
```
Once the extension is installed and enabled, you can use geometric data types and perform spatial operations in your PostgreSQL database.
阅读全文