Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gW2BB-0008Hr-Mh for pgsql-general@arkaria.postgresql.org; Sun, 09 Dec 2018 16:43:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gW2B9-0006o0-0M for pgsql-general@arkaria.postgresql.org; Sun, 09 Dec 2018 16:43:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gW2B7-0006nm-1T for pgsql-general@lists.postgresql.org; Sun, 09 Dec 2018 16:43:38 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gW2B2-0007vk-Vq for pgsql-general@lists.postgresql.org; Sun, 09 Dec 2018 16:43:36 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 8168E20F02; Sun, 9 Dec 2018 11:43:30 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 09 Dec 2018 11:43:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=p t8RSyd6sLp0PHLpyEJ+PETwPuYDoUye2lXmw8DcDQg=; b=8jWpQoqx1aaY/5rVz C3OEzb7wh9S8iOT5IguELQjXpFA2zuSsbX+7EyO7G/aLKoL3ygvYxdYH3aB1lElN QnFk2J/wL0tS3sW2SeizWt06RYLn40lB3416uFX2C0FXgwRN5h7MyCxfU+ZRTZ+1 0dFQ3tX4ZMLKOg1ykuXcsqG5ST/PuXV1MIx6zF2zBvyLuQXzfxYWX+MIPDyAoibD ij/HCR46svi0zIcPwxTM74oqUNXhMYeubLpu53zx52erBevlzl0jAOIcrrsVWPHk NfHxJ6yonpuI6Gk+A5xyPoEEm8X9Z//gHpzmuJS81ZCW9cmkrgGLxwWBksSKo6N2 GqnkA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=pt8RSyd6sLp0PHLpyEJ+PETwPuYDoUye2lXmw8DcD Qg=; b=ohFmsgP3pX5/XpPW3tabx0F3JhiXvSXBU4cmq0G1FjqfgkK1wSZQ7Lh/U Cr58GZ8elE65SWPP9ubcMIRgpteg/W5V1ijzGmqCQ6WWBX9XJXgD9N3lcIgpUR2V CbnOlNnGydAhy+NIu5Gb/pfU7L0pKcWmfo5KhbtwtIg/umoALbKT01bC4AtRThow 1KPyn0VHjzK4CMrzF0HwJPWS5STW6o01lJFzSW3y06feiZPwolYIP+SwmPrS4/zw VaYlye9SwLp8NKPlmtxIq7f+ldCEE7KUmSwvQnIT5e8mAOYEIwtN4SvYoNwAOSpq vKnt18G8smF2wWZf142Ik1AgyRHXw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudegfedgleefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkff gfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceo rggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecukfhppeejuddrvd duvddrudefgedrfeenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgr vhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id 26D1FE455C; Sun, 9 Dec 2018 11:43:29 -0500 (EST) Subject: =?UTF-8?Q?Re=3a_Errors_with_schema_migration_and_logical_replicatio?= =?UTF-8?B?biDigJQgZXhwZWN0ZWQ/?= To: Mike Lissner Cc: pgsql-general@lists.postgresql.org References: <42bcb35c-9173-bb9e-bda6-ea5c5950119b@aklaver.com> From: Adrian Klaver Message-ID: <953748cf-7271-7230-9158-178c8e4f475e@aklaver.com> Date: Sun, 9 Dec 2018 08:43:28 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/9/18 8:03 AM, Mike Lissner wrote: > > The above seems to be the crux of the problem, how did NULL get into > the > column data? > > > I agree. My queries are generated by Django (so I never write SQL > myself), but: > >  - the column has always been NOT NULL for its entire lifetime The lifetime being since the migration did this?: ALTER TABLE "search_docketentry" ADD COLUMN "recap_sequence_number" varchar(50) DEFAULT '' NOT NULL; ALTER TABLE "search_docketentry" ALTER COLUMN "recap_sequence_number" DROP DEFAULT; Also does the column recap_sequence_number appear in any other tables. Just wondering if the error was on another table? >  - we don't send *any* SQL commands to the replica yet, so that's not a > factor (for now it's just a live backup) >  - the publisher now has a NOT NULL constraint on that column. I never > had to clear out null values to put it in place. I assume that if that This part confuses me. You seem to imply that the column existed before the migration and you just added a NOT NULL constraint. The migration shows the column being created with a NOT NULL constraint. > column ever had a null value and I tried to run a DDL to add a null > constraint, the DDL would have failed, right? > > Something feels wrong here, the more I think about it. A start would be to figure out what generated?: failing row contains (48064261, 2018-12-07 04:48:40.388377+00, 2018-12-07 04:48:40.388402+00, null, 576, , 4571214, null, null) -- Adrian Klaver adrian.klaver@aklaver.com