Re: clone_schema function - Mailing list pgsql-general

From Predrag Maric
Subject Re: clone_schema function
Date
Msg-id CAHA2AHsFhuQtVEAfSeyXBqfYT6unsabH2x=xjZqcec5xUti2jg@mail.gmail.com
Whole thread Raw
In response to clone_schema function  (Melvin Davidson <melvin6925@gmail.com>)
List pgsql-general
The script is generating foreign keys which reference tables in the source schema.
I had to change 

219    SELECT 'ALTER TABLE ' || quote_ident(dest_schema) || '.' || quote_ident(rn.relname) 
220                          || ' ADD CONSTRAINT ' || quote_ident(ct.conname) || ' ' || pg_get_constraintdef(ct.oid) || ';'

to 

219    SELECT 'ALTER TABLE ' || quote_ident(dest_schema) || '.' || quote_ident(rn.relname) 
220                         || ' ADD CONSTRAINT ' || quote_ident(ct.conname) || ' ' || replace(pg_get_constraintdef(ct.oid), quote_ident(source_schema) || '.', quote_ident(dest_schema) || '.') || ';'

I'm attaching the updated script.
Attachment

pgsql-general by date:

Previous
From: "Day, David"
Date:
Subject: Re: strange connection problem.
Next
From: anj patnaik
Date:
Subject: Fwd: trouble downloading postgres 9.4 for RHEL 6.x