This article will discuss a specific subject about sequence in PostgreSQL database server. That specific subject about sequence is in the way PostgreSQL database server will display, show or list the available sequence in PostgreSQL database server. Actually, in this article, displaying those sequences available in the PostgreSQL database server is easy. Just execute the correct command in the PostgreSQL command console. So, in order to achieve it, the following are steps to do it :
1. Make sure that PostgreSQL database server is running. Read the articles about PostgreSQL Database Server in this link. In that page, there are links of articles for checking the PostgreSQL database server’s status. One of the article is an article with the title of ‘How to Check PostgreSQL Database Server’s service status.’
2. Try to access the PostgreSQL command console. For further reference, read the article with the title of ‘How to Access PostgreSQL Database Server via Command Line. Another one is an article with the title of ‘Connecting to PostgreSQL Database via Linux Shell Command‘ and also the article with the title of ‘Connect to PostgreSQL command line Linux‘.’.
The following is an example of accessing the PostgreSQL command console :
C:\Users\Personal>psql -Upostgres -d mydb Password for user postgres: psql (12.2) WARNING: Console code page (437) differs from Windows code page (1252) 8-bit characters might not work correctly. See psql reference page "Notes for Windows users" for details. Type "help" for help. mydb=#
The above example is an example for accessing PostgreSQL command console using ‘postgres’ user. It also select database with the name of ‘mydb’. The process for accessing PostgreSQL command console is in Windows operating system.
3. After successfully access PostgreSQL command console, execute the following command pattern to display, view or show the available sequences :
Using the above command pattern or the above query pattern, the following is the output of the query or command execution to view the available sequence in the database :
mydb=# \ds List of relations Schema | Name | Type | Owner --------+-----------------+----------+---------- public | mytable_id_seq | sequence | postgres (1 row) mydb=#