| From: | Predrag Maric <predrag4(at)gmail(dot)com> |
|---|---|
| To: | melvin6925(at)gmail(dot)com |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: clone_schema function |
| Date: | 2015-10-23 14:50:15 |
| Message-ID: | CAHA2AHsFhuQtVEAfSeyXBqfYT6unsabH2x=xjZqcec5xUti2jg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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 | Content-Type | Size |
|---|---|---|
| clone_schema.sql | text/plain | 13.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Melvin Davidson | 2015-10-23 14:52:01 | Re: clone_schema function |
| Previous Message | Adrian Klaver | 2015-10-23 14:36:45 | Re: strange connection problem. |