Re: PL/PGSQL + inserts+updates+limit - Postgres 9.3 - Mailing list pgsql-general

From Adrian Klaver
Subject Re: PL/PGSQL + inserts+updates+limit - Postgres 9.3
Date
Msg-id 54769d52-10ab-4358-11c4-49035658da8a@aklaver.com
Whole thread Raw
In response to Re: PL/PGSQL + inserts+updates+limit - Postgres 9.3  (Patrick Baker <patrickbakerbr@gmail.com>)
Responses Re: PL/PGSQL + inserts+updates+limit - Postgres 9.3  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
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@aklaver.com


pgsql-general by date:

Previous
From: Leonardo M. Ramé
Date:
Subject: Re: Londiste3 - Ubuntu 16.04 - Postgresql 9.3
Next
From: "David G. Johnston"
Date:
Subject: Re: [pg_trgm] Making similarity(?, ?) < ? use an index