When working with PostgreSQL and PostGIS, it’s important to know which versions are installed on your hosting account. On ruachost.com, you can check these versions directly from the command line or within SQL queries.

 

Why Check Versions?

  • Ensure compatibility with applications and extensions.

  • Verify support for specific features.

  • Troubleshoot errors related to outdated versions.

 

Steps to Determine PostgreSQL Version

Method 1: Using Command Line

  1. Log in to your hosting account via SSH.

  2. Run the following command:

    Bash
    
    psql --version
    

    Example output:

     
    psql (PostgreSQL) 14.2
    ​

Method 2: Using SQL Query

  1. Connect to PostgreSQL using psql:

    Bash
    
    psql -U username dbname
    

     

  2. Run the query:

    SELECT version();
    

    Example output:

    PostgreSQL 14.2 on x86_64-pc-linux-gnu, compiled by gcc, 64-bit
    
    
    
 

Steps to Determine PostGIS Version

Method 1: Using SQL Query

  1. Connect to your database with psql.

  2. Run the query:

    SELECT PostGIS_Version();
    

    Example output:

    3.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
    

Method 2: Using Extended Function

SELECT PostGIS_Full_Version();

This provides detailed information about PostGIS, GEOS, PROJ, and other libraries.

Important Notes

  • Replace username and dbname with your actual PostgreSQL credentials.

  • Ensure PostGIS is installed on your database before running PostGIS queries.

  • If PostGIS functions return errors, the extension may not be enabled. You can enable it with:

    CREATE EXTENSION postgis;
    
آیا این پاسخ به شما کمک کرد؟ 0 کاربر این را مفید یافتند (0 نظرات)

Powered by WHMCompleteSolution