On 06/03/2016 12:23 AM, Patrick Baker wrote:
-- Creating the backup table with the essential data INSERT INTO table2 (row.note_id, row.size, row.file_id, row.full_path) ..... Still not seeing what the JOIN to table3 t3 gets you? Any way the function works. I changed the function to use row.note_id, row.size, etc... think it's more intelligent that way! :) Is there any way to create another function to restore the data back?
I am sure there is, but it will probably be more difficult then copying that data in the first place. From your previous function there seems to be lot of moving parts. Unwinding those tables and any other data that is dependent on those tables could be a chore.
Example: select function_data_1_restore(123414); Where 123414 = file_id How can I tell the function to get the file_id that I'll insert into the call?
That would depend on why and what you want to restore. The function is going to need some sort of prompting from the user on what criteria to use to determine the records to select and restore.
Can you please guys tell me?
My help would be to say, first sit down and draw out the dependencies you have between the data and the various tables. Then work out an outline form of how to walk the data back from those tables into its original location(s).
cheers
-- Adrian Klaver adrian.klaver@xxxxxxxxxxx -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general