Re: Cloning schemas - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Cloning schemas
Date
Msg-id 8d9c5213-3b73-faaa-a2b5-9e17b1ee7585@aklaver.com
Whole thread Raw
In response to Re: Cloning schemas  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
On 07/09/2018 03:23 PM, Adrian Klaver wrote:
> On 07/09/2018 02:50 PM, Melvin Davidson wrote:
>>
>> Adrian,

> 
> The problem is that the relname/object has changed in the new schema. In 
> this case from text_idx --> idx_test_id_idx. So this happens:
> 
> test_(postgres)# comment on index sch_test.test_idx is 'test';
> ERROR:  relation "sch_test.test_idx" does not exist
> 
> 
> Just some muddling do with it what you will:)
> 

Should have added to the above that INCLUDING ALL encompasses INCLUDING 
COMMENTS:

https://www.postgresql.org/docs/10/static/sql-createtable.html

"Comments for the copied columns, constraints, and indexes will be 
copied only if INCLUDING COMMENTS is specified. The default behavior is 
to exclude comments, resulting in the copied columns and constraints in 
the new table having no comments."

So the COMMENT ON INDEX code is redundant anyway.

-- 
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: Cloning schemas
Next
From: Shawn Mulloney
Date:
Subject: Reconnecting a slave to a newly-promoted master