L
L
lssssssssssl2020-11-24 15:38:12
PostgreSQL
lssssssssssl, 2020-11-24 15:38:12

How to transfer a table between databases (attempt number 2)?

I am a complete 0 in databases and I am deeply confused. Help me find the answer to a few questions. I have 2 psql databases in docker. The first database (its name is postgres) has a simple table that stores rows and the id of those rows. How can I programmatically transfer this table from the first database to the second (arr_test), in which there is no such table? If it's even easier to explain - On the last screen, I access the table in the first database and get data from it, I want that after the transfer, I can access the second database in this way and see the same result there. And can it be done at all in this case? It is desirable such an explanation, so that it would be right for the most stupid person on the planet. Thank you.5fbcfc34f38f8497946669.png5fbcfc49e1870502769473.png5fbcfc5eacbde548589777.png5fbcfea0b80ac084012500.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2020-11-24
@lsssssssssl

It is desirable such an explanation, so that it is right for the most stupid person on the planet.

Please:
Dump the table from the first database (no matter how, COPY-query, pg_dump or something else), take the resulting data and load it into the second database, having previously created a table with the desired name there. The specific implementation depends on the tools you use. In a postgreat docker or not in a docker - it doesn't matter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question