Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jS0G6-00056u-4N for pgsql-bugs@arkaria.postgresql.org; Fri, 24 Apr 2020 15:28:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jS0G4-00017t-GT for pgsql-bugs@arkaria.postgresql.org; Fri, 24 Apr 2020 15:28:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jS0G4-00014V-A1 for pgsql-bugs@lists.postgresql.org; Fri, 24 Apr 2020 15:28:52 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jS0Fw-0001nC-Q1 for pgsql-bugs@lists.postgresql.org; Fri, 24 Apr 2020 15:28:51 +0000 Received: by mail-qk1-x743.google.com with SMTP id b188so8928447qkd.9 for ; Fri, 24 Apr 2020 08:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=25wn6LDFf8TpoQELdb/QyHX/f/kr2dcphMB3dBHa6OE=; b=g2+OWuBXC+jWJnQLgHmqrJAIbMlWZxalxIp+2HBXmTD531/54F1xy3ZF84dzCe3/92 GCoJKuVxawFhEnIekyOAk5i+Ydwl3rnXnFwd2HVarFKZuNhOgc+ag9ZBpkCdXTVDR4pF na4CYFrPyC6Cqk3Hw46l8zh/4AZ90tzxZVay1pq01MuctN+mV5Aesv7n8uQbwGg64DT/ jqxVenTb6uHEsE8ZFD2qIa1k66aT4U016fMfLyaigdDJL08I36Mgv9EscQGIc47Xyo7H w+s6VwQy1qg6FM3tO8cjMBKkKVp3cykHxTHgj+kfZoKB+v2st+eSsN0aPp21+/T4XItO /nFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=25wn6LDFf8TpoQELdb/QyHX/f/kr2dcphMB3dBHa6OE=; b=RkOApTBjodBm2iFBUBZfhw9yazDWZBd4JFGIlZsL1g0LFmp7zCIXKuSbsZkFWtlJqQ UWdzQg1mGAhqreFJyReXli20CJj8MJ6PG/M+aU6GnRbEHmIAeZa7otcbEHBqqp8M5ubD xE1DottY+NO7ANjYsX4u1I03L8Z7L2Ka1GcRF9q7RUyGGl4hkzKYLRxxBzXlOU5o3dgp 7mUMg7s0gLRb7IDH5tZpB0PV9vuxjuRLXo2DA1KK0ggAB1qoiu5fenmISYDkiq0IgDu2 R87D3wkVgWIqn41/wPsjyWqlNxLD+QK70sC5F8IhC1iB+bOTLy+KTamcDmtXVoI7DXze XpTA== X-Gm-Message-State: AGi0PuYjqEIfAiHBA+vs6f0tKp/7L7WBkHJfchGxyLdKXi0p1CnbZJ3K S/+9UabY6/eAvg+wy7iQtUUX6w== X-Google-Smtp-Source: APiQypL4bi1mGzW6iI6hDqYhZT9CqmZMULv+GUuoI+wtaCpSh6mXE5eJMp9CitBBj+JLU81K+YmZUQ== X-Received: by 2002:a37:4a14:: with SMTP id x20mr9454420qka.357.1587742122043; Fri, 24 Apr 2020 08:28:42 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id j25sm3956483qtn.21.2020.04.24.08.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 08:28:41 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 5741B30162D; Fri, 24 Apr 2020 11:28:39 -0400 (-04) Date: Fri, 24 Apr 2020 11:28:39 -0400 From: Alvaro Herrera To: Euler Taveira Cc: pgsql-bugs@lists.postgresql.org, szittya314@gmail.com Subject: Re: BUG #16386: drop contraint in inherited table is missing in pg_dump backup Message-ID: <20200424152839.GA28038@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Apr-24, Euler Taveira wrote: > On Fri, 24 Apr 2020 at 07:09, PG Bug reporting form > wrote: > > > create table b (aaa int primary key,bb date ); > > create table A (id int primary key) inherits (B); > > alter table a alter column aaa drop not null; > > > > after i made pg_dump and pg_restore the not null contraint isexist on table > > a; > > > It does not make sense to exclude a not null constraint on an inherited > table because column "aaa" can be null in table "a" but a SELECT in table > "b" will return a NULL for a primary key (ugh). It is just one of the ways > to shoot yourself in the foot. If you check CREATE TABLE synopsis, there > isn't NO INHERIT for not null constraints. Maybe it is worth adding a note > in CREATE TABLE. I agree with your analysis, but in that case we should make the DROP NOT NULL throw an error instead of proceeding. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services