Hi,
On Fri, Jan 14, 2022 at 12:19:28PM +0000, Flaviu2 wrote:
> Thanks a lot.
> Maybe I am not far from a solving solution. So, if I create a database, lets say (SQL script):
> CREATE database mydb3;
> How can I create a table under mydb3 ? Because, if I run:
> SELECT relname FROM pg_class WHERE relkind = 'r';
>
> Got me all tables, but I don't know the database under were created.
On postgres all relations, functions and so on are specific to a specific
database, and only accessible when connected on that specific database.
So if you want to create a table in mydb3, or see the list of tables in that
database, you need to connect to mydb3.
If needed, you can get the current database with the current_database()
function, e.g.:
=# SELECT current_database();
current_database
------------------
postgres
(1 row)