psql select not working

postgres not null

psql select not working

PSQL Select not working – or other simple commands not working

Working with command line postgres tool psql and having an issue?

Why doesn’t the psql command show the simple select query?

PSQL select not working is a problem that can happen in either of the following scenarios:

  1. Are you on the right database?
    Chances are you might not be on the right database at all and the relation you are trying to find might not be there at all:Check if you are on the right database.
     
    Run the command \l to see the available databases.How to connect to the postgres database from the list?
    Use the command \c database_name
    Let’s say the database name is inventory then:\c inventory will connect you to the right database
  2. Does the table exist?
    You might find this funny, but you might be surprised when you realize you are querying the wrong table or misspelled table name and get psql select not working or other related error.
     
    How do I list and see all the postgres tables:Use the \d to list all the tables in the current database.  Like wise, you can also use \dt as well. It will hide some of the internal tables like sequence and show you other significant tables.
     
    So do the \d and check if you have the table listed, or check the spelling is right.
    It could be the reason of the psql select not working problem solution.
  3. Are you using the right schema?
    Here is the last place to check for the psql command not working problem. The schema unless you define it, could be by default a public schema.
     
    When you issue the \dt command you will see the first column to be schema.That is, you might want to try your query along with schema to make sure the right schema is used. Lets say you are issuing SELECT * From inventory.
     
    Now, use the right schema, lets use public, it will be SELECT * FROM public.inventory. Again, you can find the schema from the table listing command.
  4. Time to restart? Yup,  caching and other issues might be tampering the psql and lead to the psql select not working issue. Just close the session and reopen and give it a shot.

For more, checkout this link.

Good luck.

XDebug connects but doesn’t stop on breakpoints

PDO not throwing any exceptions

Apache not executing PHP code – just renders the as it is

Process Commands in Linux

Bash directories coloring lost in unix when using ls

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*