diff --git a/product_docs/docs/postgis/3.1/02_creating_extensions.mdx b/product_docs/docs/postgis/3.1/02_creating_extensions.mdx index 24c53553909..1487d20f301 100644 --- a/product_docs/docs/postgis/3.1/02_creating_extensions.mdx +++ b/product_docs/docs/postgis/3.1/02_creating_extensions.mdx @@ -12,32 +12,32 @@ After installing PostGIS, create a PostGIS database and the extensions in each d 1. Before creating the postgis database, we recommend creating a superuser to administer the database. To create the user, navigate to the bin directory under your EDB Postgres Advanced Server installation and connect to the server with the psql client: - ```text + ```sql ./psql -d edb -U enterprisedb -h 127.0.0.1 ``` 2. Invoke the following command to create a privileged role: - ```text + ```sql CREATE ROLE gisadmin LOGIN PASSWORD 'password' SUPERUSER; ``` 3. Log out of psql and connect as gisadmin: - ```text + ```sql edb=# \q ./psql -d edb -U gisadmin -h 127.0.0.1 ``` 4. Invoke the following command to create the postgis database owned by gisadmin: - ```text + ```sql CREATE DATABASE postgis; ``` 5. Use the `\c` command to switch to the postgis database, and use the `CREATE EXTENSION` command to create the PostGIS extensions: - ```text + ```sql \c postgis CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology; diff --git a/product_docs/docs/postgis/3.1/03_upgrading_postgis.mdx b/product_docs/docs/postgis/3.1/03_upgrading_postgis.mdx index 378eba65654..3e90bce3114 100644 --- a/product_docs/docs/postgis/3.1/03_upgrading_postgis.mdx +++ b/product_docs/docs/postgis/3.1/03_upgrading_postgis.mdx @@ -23,13 +23,13 @@ The following example walks you through the process of upgrading PostGIS version 1. To upgrade PostGIS version 2.4.6 to PostGIS version 3.1.1 for EDB Postgres Advanced Server 9.6, assume the superuser privileges and invoke the following command: - ```text + ```shell yum upgrade edb-as96-postgis-3.1.1 -y ``` 2. To update extensions, switch to `enterprisedb` user, connect to the database (where you have already created extensions) with the psql client application, and execute the following commands: - ```text + ```sql edb=# alter extension postgis update to '3.1.1'; WARNING: unpackaging raster WARNING: PostGIS Raster functionality has been unpackaged @@ -37,12 +37,12 @@ The following example walks you through the process of upgrading PostGIS version ALTER EXTENSION ``` - ```text + ```sql edb=# alter extension address_standardizer update to '3.1.1'; ALTER EXTENSION ``` - ```text + ```sql edb=# SELECT postgis_extensions_upgrade(); NOTICE: Updating extension postgis_sfcgal from 2.4.6 to 3.1.1 NOTICE: Packaging extension postgis_raster @@ -74,13 +74,13 @@ Step 1 - To upgrade PostGIS version 2.4.6 to 3.1.2, you need to upgrade it to 3. 1. Navigate to the bin directory of EDB Advanced Server 9.6: - ```text + ```shell cd /usr/edb/as9.6/bin/ ``` 2. Assume the superuser privileges and invoke the following command to upgrade to PostGIS version 3.1.1: - ```text + ```shell yum upgrade edb-as96-postgis-3.1.1 -y ``` @@ -89,7 +89,7 @@ Step 1 - To upgrade PostGIS version 2.4.6 to 3.1.2, you need to upgrade it to 3. 3. To update extensions, switch to `enterprisedb` user, connect to the database (where you have already created extensions) with the psql client application, and execute the following commands: - ```text + ```sql edb=# alter extension postgis update to '3.1.1'; WARNING: unpackaging raster WARNING: PostGIS Raster functionality has been unpackaged @@ -97,12 +97,12 @@ Step 1 - To upgrade PostGIS version 2.4.6 to 3.1.2, you need to upgrade it to 3. ALTER EXTENSION ``` - ```text + ```sql edb=# alter extension address_standardizer update to '3.1.1'; ALTER EXTENSION ``` - ```text + ```sql edb=# SELECT postgis_extensions_upgrade(); NOTICE: Updating extension postgis_sfcgal from 2.4.6 to 3.1.1 NOTICE: Packaging extension postgis_raster @@ -118,13 +118,13 @@ Step 2 - Upgrade to PostGIS version 3.1.2 1. To upgrade PostGIS version 3.1.1 to 3.1.2, invoke the following command for EDB Postgres Advanced Server 9.6: - ```text + ```shell yum upgrade edb-as96-postgis-3.1.2 -y ``` 2. To update extensions, switch to `enterprisedb` user and execute the following commands: - ```text + ```sql edb=# alter extension postgis update to '3.1.2'; WARNING: unpackaging raster WARNING: PostGIS Raster functionality has been unpackaged @@ -134,12 +134,12 @@ Step 2 - Upgrade to PostGIS version 3.1.2 With PostGIS version 3.1.2, the return type of the raster functions has changed, which requires dropping and creating the raster extension as part of the upgrade process. - ```text + ```sql edb=# drop extension postgis_raster; DROP EXTENSION ``` - ```text + ```sql edb=# SELECT postgis_extensions_upgrade(); NOTICE: Updating extension postgis_sfcgal from 3.1.1 to 3.1.2 NOTICE: Updating extension postgis_topology from 3.1.1 to 3.1.2 @@ -150,19 +150,19 @@ Step 2 - Upgrade to PostGIS version 3.1.2 (1 row) ``` - ```text + ```sql edb=# alter extension address_standardizer update to '3.1.2'; ALTER EXTENSION ``` Quit and re-open the psql client session: - ```text + ```sql edb=# \q ./psql -d edb -p 5444 ``` - ```text + ```sql edb=# create extension postgis_raster; CREATE EXTENSION ``` @@ -171,19 +171,19 @@ Step 3 - Upgrade EDB Postgres Advanced Server version 9.6 to to 13: 1. Assume the superuser privileges to stop the EDB Postgres Advanced Server 9.6 service: - ```text + ```shell systemctl stop edb-as-9.6 ``` 2. Install the EDB Postgres Advanced Server version 13: - ```text + ```shell yum install edb-as13-server -y ``` 3. Navigate to the bin directory of EDB Advanced Server 13 and initialize the cluster: - ```text + ```shell cd /usr/edb/as13/bin/ ./edb-as-13-setup initdb @@ -191,19 +191,19 @@ Step 3 - Upgrade EDB Postgres Advanced Server version 9.6 to to 13: 4. Install the PostGIS version 3.1.2 for EDB Postgres Advanced Server version 13.0: - ```text + ```shell yum install edb-as13-postgis3-3.1.2 -y ``` 5. Assume the superuser privileges to stop the EDB Postgres Advanced Server 13.0 service: - ```text + ```shell systemctl stop edb-as-13 ``` 6. Switch to `enterprisedb` user and create a `temp` folder: - ```text + ```shell su enterprisedb cd $(mktemp -d) ``` @@ -300,7 +300,7 @@ Step 3 - Upgrade EDB Postgres Advanced Server version 9.6 to to 13: 8. Assume the superuser privileges, navigate to the `bin` directory of EDB Postgres Advanced Server 13, and start the service: - ```text + ```shell cd /usr/edb/as13/bin/ systemctl start edb-as-13 @@ -308,7 +308,7 @@ Step 3 - Upgrade EDB Postgres Advanced Server version 9.6 to to 13: 9. To update extensions, switch to `enterprisedb` user, connect to the database (where you have already created extensions) with the psql client application, and execute the following commands: - ```text + ```sql su enterprisedb ./psql -d edb -p 5444 edb=# SELECT PostGIS_Extensions_Upgrade(); diff --git a/product_docs/docs/postgis/3.1/04_using_postgis.mdx b/product_docs/docs/postgis/3.1/04_using_postgis.mdx index 5dea692d7bb..e64d19e85eb 100644 --- a/product_docs/docs/postgis/3.1/04_using_postgis.mdx +++ b/product_docs/docs/postgis/3.1/04_using_postgis.mdx @@ -12,19 +12,19 @@ The following examples use PostGIS functions to create and query spatial objects The following command creates a table named `roads` that holds GIS data and a geometry column. -```text +```sql CREATE TABLE roads ( ID int4, NAME varchar(128) ); ``` Use the PostGIS `AddGeometryColumn` function to add a column to the table: -```text +```sql SELECT AddGeometryColumn( 'roads', 'geom', -1, 'GEOMETRY', 2 ); ``` Use the following SQL commands to insert data into the table `roads`. This data consists of the geometry of the type of `Linestring` (a line between two points): -```text +```sql INSERT INTO ROADS (ID,GEOM,NAME ) VALUES (1,ST_GeomFromText('LINESTRING(0 10,0 0)',-1),'Beacon Road'); INSERT INTO ROADS (ID,GEOM,NAME ) VALUES (2,ST_GeomFromText('LINESTRING(0 0,0 10)',-1),'Violet Road'); INSERT INTO ROADS (ID,GEOM,NAME ) VALUES (3,ST_GeomFromText('LINESTRING(0 0,10 0)',-1),'Skelton Street'); @@ -35,15 +35,15 @@ INSERT INTO ROADS (ID,GEOM,NAME ) VALUES (6,ST_GeomFromText('LINESTRING(10 0,0 0 You can use the `GIST` function to create an index on the geometry column: -```text +```sql CREATE INDEX roads_index ON roads using GIST (geom); ``` `AsText(geometry)` is a PostGIS function that returns a text representation of the geometry: -```text +```sql SELECT id, ST_AsText(geom) AS geom, name FROM ROADS order by id; - +__OUTPUT__ id | geom | name ----+-----------------------+---------------- 1 | LINESTRING(0 10,0 0) | Bacon Road @@ -57,9 +57,9 @@ SELECT id, ST_AsText(geom) AS geom, name FROM ROADS order by id; After an index is created, you can use the `&&` operator in a query: -```text +```sql SELECT NAME, ST_AsText(GEOM) FROM ROADS WHERE GEOM && SetSRID('BOX3D(10 10,10 10)'::box3d,-1); - +__OUTPUT__ name | astext --------------+----------------------- Fifth Avenue | LINESTRING(0 0,10 10) @@ -70,10 +70,9 @@ Use the `BOX3D` function to specify a bounding box. The `&&` operator uses the i You can use the `~=` operator to check if two geometries are geometrically identical: -```text +```sql SELECT ID, NAME FROM roads WHERE GEOM ~= ST_GeomFromText('LINESTRING(0 10,0 0)',-1) order by id; - - +__OUTPUT__ id | name ----+------------- 1 | Bacon Road diff --git a/product_docs/docs/postgis/3.1/05_uninstalling_postgis.mdx b/product_docs/docs/postgis/3.1/05_uninstalling_postgis.mdx index 37e4772c7e7..a84aa5f807c 100644 --- a/product_docs/docs/postgis/3.1/05_uninstalling_postgis.mdx +++ b/product_docs/docs/postgis/3.1/05_uninstalling_postgis.mdx @@ -16,13 +16,13 @@ To uninstall PostGIS on a CentOS/RHEL host, assume the identity of the root user On CentOS/RHEL 7 for EPAS version 13: -```text +```shell yum -y erase edb-as13-postgis3* ``` On CentOS/RHEL 7 for older versions of EPAS: -```text +```shell yum erase edb-as-postgis-* ``` @@ -30,13 +30,13 @@ Where *<xx>* is the Advanced Server version and <y.y.y> is the PostGIS ver On Rocky Linux/AlmaLinux/RHEL 8 for EPAS version 13: -```text +```shell dnf -y erase edb-as13-postgis3* ``` On Rocky Linux/AlmaLinux/RHEL 8 for older versions of EPAS: -```text +```shell dnf erase edb-as-postgis-* ``` @@ -44,7 +44,7 @@ dnf erase edb-as-postgis-* To uninstall PostGIS on a Debian or Ubuntu host, invoke the following command: -```text +```shell apt-get remove edb-as-postgis-* ``` @@ -54,7 +54,7 @@ Where *<xx>* is the Advanced Server version and <y.y> is the PostGIS versi To uninstall PostGIS on a SLES host, assume the identity of the root user and invoke the following command: -```text +```shell zypper remove edb-as12-postgis* ```