0
I’m trying to copy a record from a database table, but the problem is that this table has a lot of links, foreign keys. The record should involve about 40 tables. Is there any way I can do this? I just need to duplicate the record by changing a single value. It’s possible?
I couldn’t do anything.
Is there no way to make an Insert by just changing what you need? You can explain better?
– rzani
To put it better, I have some records here in the bank, which correspond to a questionnaire, only a questionnaire has people involved, has hours worked, various data, which are in another table... I wanted to duplicate a questionnaire, only for that, have replicate the data in all tables.
– João Neto
Yes it is possible => Copy data from one database to another postgress
– rray
It’s not really that, it’s copying the same tables. When I open the program that consumes this bank, I want you to have 2 questionnaires, one equal to the other, just with the different ID.
– João Neto
Tables are in the same database? what is the problem you have now? mount query? FK violation?
– rray
The problem is like this: Let’s assume that I duplicate a row of the QUESTIONNAIRES table, so let’s assume that each questionnaire has an ID, 1 and 2, in the other tables I have records referencing ID 1, I need these records also to be duplicated, but referencing ID 2. Did you understand more or less? I need to duplicate the questionnaire completely.
– João Neto