I'm working with postgres14 in a docker container on a remote Rocky Linux VM. After a little bit of pain I managed to access the database from outside the container, at which point I wanted to create a test database and some test tables to see if everything goes well. Unfortunately it doesn't, and here are the steps I'm going through.

  1. connect to postgres

    psql -U username -h container_ip

  2. once I'm in, I want create the db

    create database mydb

  3. now I try to create a table

    \c mydb

    create table mytable

  4. trying to check if it's created \dt

    out: Did not find any relations.

Now I checked this question as well as this one, but since I'm not really a DBA or anything of a sort I'm having a hard time understanding how to apply these answers to my particular problem. I tried altering search_path as suggested in one of the answers on these two links, in particular setting it to a public schema for mydb, but that didn't work.

Does anyone have an answer? Thank you very much!

  • This maybe? stackoverflow.com/questions/12472026/…
    – user1822
    Jan 25 at 7:18
  • @a_horse_with_no_name I managed to create a table by using create table test(id int);CREATE TABLE syntax, but I can't do anything else, like select * from test for example. If I end statements with semicolons, I'm getting Syntax error.
    – skippynk
    Jan 25 at 10:20


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.