How To Use Autocomplete Feature in Query Tool

June 10, 2022

How to use autocomplete in Query Tool

To use autocomplete, begin typing your query; when you would like the query editor to suggest object names or commands that might be next in your query, press the Control + Space key combination. For example, type "SELECT * FROM " (without quotes, but with a trailing space), and then press the Control + Space key combination to select from a popup menu of autocomplete options.

Autocompletion for keywords

For keywords just type a few characters and press the Control + Space key combination.

Autocompletion for Keywords

Autocompletion of schema and schema objects

To use schema and its objects, type the schema name and ‘. ’ and press the Control + Space key combination.

Search path in the query tool

Search path in the query tool

Set search path in the Query Tool

In the previous example and screenshot you can not see the objects of ‘test_schema_diff’ until you type the schema name and ‘.’. Users can set the search path and then try the same ‘SELECT’ query. You will see all the objects of ‘test_schema_diff’ after setting the search path.

Set search path in the query tool

Autocompletion of joins

To use joins type the start of the query and press the Control + Space key combination.

Autocompletion of joins

Third party code used to implement autocomplete

pgAdmin 4 utilises the code from https://www.pgcli.com/ and modifies slightly to work as needed. Pgcli uses prompt_toolkit, and pgAdmin 4 integrates this code with the Code Mirror library to implement autocompletion. 

Conclusion

Use the autocomplete feature to write SQL commands more quickly by reducing the typing effort and providing quick access to the database object information.

Share this

Relevant Blogs

How to use pgAgent in pgAdmin 4

pgAgent is a tool used for scheduling jobs for PostgreSQL databases. Each job consists of steps and schedules. Creating a pgAgent job To create or manage a job, use the...
May 10, 2023

Setup pgAdmin development environment

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL. In this blog, I will walk you through how to set up the pgAdmin...
May 10, 2023

More Blogs

pgAdmin with Kerberos and Active Directory

pgAdmin supports Kerberos authentication for user logins as well as connecting to databases. Kerberos is a popular authentication method but many people find it difficult to set up especially with...
March 21, 2023