E
E
Emil Rakhmatullin2021-09-28 18:03:42
PostgreSQL
Emil Rakhmatullin, 2021-09-28 18:03:42

Can't see contents of Postgresql table. Why?

This is my first time using such a database...
Connected to a remote VPS server Ubuntu 16.04.
My actions:

  1. *connected via SSH*
  2. su postgres
  3. \connect my_table
  4. \z
  5. \d

Everything is ok, but it gives me either Did not find any relations., or (0 rows).
Although the base is EXACTLY correct and EXACTLY used. It cannot be empty. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
galaxy, 2021-09-28
@galaxy

2. su postgres
3. \connect my_table

Right away right away? psqldidn't forget?
my_table is what? Table name? The command \connectrequires the name of the database, by default the connection goes to the database with the name of the Linux user (i.e. in your case you are connecting to postgres).
List existing databases: \l
If you connected to the desired database, there is an option that all your tables live in a separate schema that is not in the search_path.
List schemas: \dn
List tables in sname schema: List \dt sname.
table my_table in sname schema:\d sname.my_table

K
ky0, 2021-09-28
@ky0

psql -U postgres -c %ваш_запрос% dbnamewhat does it show?
Remember that there is no root user in postgres by default, and the admin account is called postgres.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question