How do Postgres create a file to populate a bank?

Asked

Viewed 1,598 times

2

I have a database in POSTGRESQL populated , I wanted to know if there is a command

SQL that returns an aqruivo that had the following command for all existing tables:

INSERT INTO aluno(id , nome, idade ) values(1,'Raul',23)

I wanted to do this to populate another database that has data similar to the old database , but has new tables!

  • Just to be clear, you need to generate a file with the SQL’s command to insert the data already registered in your old tables in order to add them to new tables but with the same structure?

  • If so, please see if this link helps you http://www.guj.com.br/t/postgresql-gerar-script-de-um-banco-populado-resolvido/291383/3

  • These new tables are created in which database? It’s Postgresql too

  • It’s another bank in Postgressql too!

2 answers

3


To generate the commands insert of the data contained in the database you can do as follows:

Select the Plain format

inserir a descrição da imagem aqui

In the Dump Options 1 tab, mark "Date"

inserir a descrição da imagem aqui

In the Dump Options 2 tab, mark "User Insert Commands"

inserir a descrição da imagem aqui

I suggest using Notepad++ to open

inserir a descrição da imagem aqui

  • Thanks for your attention, your answer seems to be right but I can’t see the data in Notepad++ , I use version 7.2 and Pgadmin 9.6. Which version of Pgadmin you use?

  • Have you selected the data type "Plain"? I use postgresql 9.5 and pgAdmin 3. But I believe that the format you used is not "Plain"

  • @He scolded me because I used postgresql 9.6 and pgAdmin 3! But I will install version 9.5! This version 9.6 came with pgAdmin Masi slow and a strange interface !! Thank you!

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.