Re: pg_restore remap schema

2022-11-17 Thread Fabrice Chapuis
Postgres allows us to rename a schema with the command *alter schema schema_orig rename to schema_dest*. however the definition of functions belonging to the original schema are not modified. CREATE OR REPLACE FUNCTION foo.fcount() RETURNS integer AS $$ declare v_count integer; BEGIN

Re: pg_restore remap schema

2022-11-16 Thread Thomas Kellerer
Tom Lane schrieb am 08.08.2022 um 20:22: > Guillaume Lelarge writes: >> Le lun. 8 août 2022 à 18:28, Fabrice Chapuis a >>> Is a development in progress to add this option > >> Nope, never heard of someone working on this. > > People have asked for such a thing before, but it'd be quite difficult

Re: pg_restore remap schema

2022-11-16 Thread Tom Lane
=?UTF-8?Q?St=C3=A9phane_Tachoires?= writes: > And could it be at pg_dump level ? > It seems more aware of what is doing... pg_dump would be in a slightly better position, but only slightly. It still has no idea about the contents of function bodies. Also, if it's acceptable to do this at dump ti

Re: pg_restore remap schema

2022-11-16 Thread Stéphane Tachoires
Hi And could it be at pg_dump level ? It seems more aware of what is doing... Stephane Le mer. 16 nov. 2022 à 15:42, Tom Lane a écrit : > Guillaume Lelarge writes: > > Le mer. 16 nov. 2022 à 13:08, Fabrice Chapuis > a > > écrit : > >> I worked on the pg_dump source code to add remap schema fu

Re: pg_restore remap schema

2022-11-16 Thread Tom Lane
Guillaume Lelarge writes: > Le mer. 16 nov. 2022 à 13:08, Fabrice Chapuis a > écrit : >> I worked on the pg_dump source code to add remap schema functionality to >> use it internally where I work. This is a first version that allows to >> remap tables, views and sequences (only to export schema).

Re: pg_restore remap schema

2022-11-16 Thread Guillaume Lelarge
Hi, Le mer. 16 nov. 2022 à 13:08, Fabrice Chapuis a écrit : > Hi, > I worked on the pg_dump source code to add remap schema functionality to > use it internally where I work. This is a first version that allows to > remap tables, views and sequences (only to export schema). Is this > development

Re: pg_restore remap schema

2022-11-16 Thread Fabrice Chapuis
Hi, I worked on the pg_dump source code to add remap schema functionality to use it internally where I work. This is a first version that allows to remap tables, views and sequences (only to export schema). Is this development likely to interest the PG community and to continue this development fur

Re: pg_restore remap schema

2022-08-08 Thread Fabrice Chapuis
Thank you for your reply. sed is a solution for making substitutions on plain text. But if we work with directory mode to use parallelism, I don't see how to proceed to make a schema remap. Editing the toc file in text mode does not work neither. Regards, Fabrice On Mon, Aug 8, 2022 at 9:27 PM M

Re: pg_restore remap schema

2022-08-08 Thread Marcos Pegoraro
> > People have asked for such a thing before, but it'd be quite difficult > to do reliably --- particularly inside function bodies, which aren't > normally parsed at all during a dump/restore. If you're willing to > accept a 95% solution, running the pg_restore output through "sed" > would likely

Re: pg_restore remap schema

2022-08-08 Thread Tom Lane
Guillaume Lelarge writes: > Le lun. 8 août 2022 à 18:28, Fabrice Chapuis a >> Is a development in progress to add this option > Nope, never heard of someone working on this. People have asked for such a thing before, but it'd be quite difficult to do reliably --- particularly inside function bo

Re: pg_restore remap schema

2022-08-08 Thread Guillaume Lelarge
Hi, Le lun. 8 août 2022 à 18:28, Fabrice Chapuis a écrit : > Hello, > I can't find an option with pg_restore to rename an exported schema > schema1 -> schema2 > That's because it doesn't exist :) > Is a development in progress to add this option > > Nope, never heard of someone working on thi