Re: Problems with pg_upgrade after change of unix user running db. - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Problems with pg_upgrade after change of unix user running db.
Date
Msg-id 5659000D.5040707@aklaver.com
Whole thread Raw
In response to Re: Problems with pg_upgrade after change of unix user running db.  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Problems with pg_upgrade after change of unix user running db.
List pgsql-general
On 11/27/2015 08:15 AM, Bruce Momjian wrote:
> On Fri, Nov 27, 2015 at 04:05:46PM +0000, Benedikt Grundmann wrote:
>>      > [as-proddb@nyc-dbc-001 upgrade-logs]$ tail pg_upgrade_dump_16416.log
>>      > pg_restore: creating CHECK CONSTRAINT seqno_not_null
>>      > pg_restore: creating CHECK CONSTRAINT seqno_not_null
>>      > pg_restore: [archiver (db)] Error while PROCESSING TOC:
>>      > pg_restore: [archiver (db)] Error from TOC entry 8359; 2606 416548282
>>      CHECK
>>      > CONSTRAINT seqno_not_null postgres_prod
>>      > pg_restore: [archiver (db)] could not execute query: ERROR:  constraint
>>      > "seqno_not_null" for relation "js_activity_2011" already exists
>>      >     Command was: ALTER TABLE "js_activity_2011"
>>      >     ADD CONSTRAINT "seqno_not_null" CHECK (("seqno" IS NOT NULL)) NOT
>>      VALID;
>>
>>      I have no idea, but this is a pg_dump bug or inconsistent system tables,
>>      rather than a pg_upgrade-specific bug.
>>
>>
>> Any recommendation on how to proceed?
>
> My guess is you are sharing the constraint name "seqno_not_null" with
> multiple tables.  I think you are going to have to dig into the system
> tables to see where that is referenced and fix it.
>

In the post below the OP shows the tables involved(they where inherited):

http://www.postgresql.org/message-id/CADbMkNM_y9ewdaWdQ_8DJ1mUC0Z_FGwTyAD2RwCHgExj2jvOHQ@mail.gmail.com

Still I did not think there was a restriction that constraint names be unique
across a database or cluster:

test=> create table tbl_a (fld_1 int CONSTRAINT fld_1_chk CHECK(fld_1 > 0) );
CREATE TABLE

test=> create table tbl_b (fld_1 int CONSTRAINT fld_1_chk CHECK(fld_1 > 0) );
CREATE TABLE

test=> \d tbl_*
                                                            
     Table "public.tbl_a"
                                                            
 Column |  Type   | Modifiers
                                                            
--------+---------+-----------
                                                            
 fld_1  | integer |
                                                            
Check constraints:
                                                            
    "fld_1_chk" CHECK (fld_1 > 0)
                                                            

                                                            
     Table "public.tbl_b"
                                                            
 Column |  Type   | Modifiers
                                                            
--------+---------+-----------
                                                            
 fld_1  | integer |
                                                            
Check constraints:
                                                            
    "fld_1_chk" CHECK (fld_1 > 0)

--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Re: [webmaster] How to commit/vacuum a batch of delete statements in a postgresql function
Next
From: Adrian Klaver
Date:
Subject: Re: 2 questions