Hello everyone, welcome to our QGIS Tutorial series. Today, we are going to learn how to open PostgreSQL table in QGIS. But please note that this is not tutorial about PostGIS. I just want to open a native PostgreSQL table in QGIS. There are many people or company that store their data in MySQL or PostgreSQL. Most of the data do not have spatial information. But still, we can work with the data in QGIS. For example, I will open a table with X and Y coordinate information. We can then display this data as points in QGIS. QGIS supports many database types such as PostgreSQL, SQL Server, MySQL, Oracle, and SQLite.
What you will learn from this tutorial
- Connect to PostgreSQL from QGIS
- Open PostgreSQL Table in QGIS
- Display data points using X and Y information in the table
Let’s jump to the first step.
Connect to PostgreSQL on QGIS
At this point, I assume you have access to your PostgreSQL server/database. There are many tutorials on the internet about how to install PostgreSQL in Windows or Linux. I will not cover this here, maybe in the next tutorial. To connect to PostgreSQL server in QGIS, do the following
- Go to Data Source | PostgreSQL. You can do this by go to Data Source Manager and then click PostgreSQL from the left panel.
- Click the New button to open the new PostgreSQL configuration window. Enter the PostgreSQL server details here. You will need the hostname or IP address, username and password for the server. Make sure you enable the option “Also list table with no geometry”. This to ensure that we can see all the tables that do not have spatial information.
- Click OK
Open PostgreSQL Table in QGIS
On the previous step, you have learned how to connect to a PostgreSQL server/database. Now let’s open some tables from the database. In the Data Source Manager window, select your PostgreSQL connection we created earlier. Click the Add button to see the list of tables in the database.
Conclusion
PostgreSQL is a robust and reliable database server. QGIS can utilize the power of PostgreSQL in many ways. We can simply open and edit the PostgreSQL table directly from QGIS. There is a good article about the relation between QGIS – PostgreSQL here.