Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2Xur-003vJ6-R3 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 May 2024 15:00:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s2Xuo-001f9x-Jb for pgsql-hackers@arkaria.postgresql.org; Thu, 02 May 2024 15:00:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2Xuo-001f9p-AD for pgsql-hackers@lists.postgresql.org; Thu, 02 May 2024 15:00:07 +0000 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s2Xum-0016Ao-Sy for pgsql-hackers@lists.postgresql.org; Thu, 02 May 2024 15:00:06 +0000 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2d8a24f8a3cso100005921fa.1 for ; Thu, 02 May 2024 08:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714662003; x=1715266803; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=mEorq/RsE93IIvVpKjAPUlXIXWAKm252wc329Q06tQQ=; b=SfjVhJZPIKzZ/KhEsdM4QsqzSVKWhbSVSgcQbnmLw+ye8SaDyjfniL8WzJrrhCNrB8 /XseZvUHpPDJJsgDNto7PV2ACRC+w5dGhuWy32rGTqpGqhFThN9DOYq03EllTbxkYREl wEkJp6001GvJYb3dyZO0osR8t5eFE2MIlkUeRjtj+vrN+nM4DMjISdD6+ilRo4IJnz3G otzGgTmNCHW37Wm3swPRPnJwdNx/1yIR5xC2mGkS7EWitaa1KQARooFIMaTpKXonusUa wLswV/x9FgxnQ1xM059rfRnTdQq9v+JXAVhRo6JxJIBVF0m8mafcpD5LoKAF3+E/b8N2 aqxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714662003; x=1715266803; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mEorq/RsE93IIvVpKjAPUlXIXWAKm252wc329Q06tQQ=; b=W8kN5p6vnLCZXJjVD1v4DZGTLK53Gn2Y+3qA1EpJJ3fiJweXZPW2vBWO3/ItsJ46Fo kkBEFBlFdvcjmZ+xr0AgTbDHMNukrIuY7SsWj1c4Kembw6wp9ZsS9RBcQb6R5MSkNA78 mC/bWPfEe157VjlTVSvj1DaRwg77ZPfNaGH3QF3CPCtQlc9KfKPaNODjt+DFwqtMWfHU FSxAHcZux5MBiqEabhKVk9G5kP6KuPnaZOCksj2y6uVaBXAou0IhLrTFzeYhrGe0WVK3 PSGeMgeiq93EyC8ByTER3Ynp436SziXvjB98tKesRL5xKNhDowv6802Kt0syn3HMxeyI qLng== X-Forwarded-Encrypted: i=1; AJvYcCUvmYJaWvplA2oEoaBG3LGmN/jrcNrK6ETbk4CHczzK5cqH6tRQPPY+y5NbfKES/YmwyG25tzjtzev7dKz69fwF3oxS1a6ZGfSql6lcHMLV4aJn X-Gm-Message-State: AOJu0YzrDN7b47ppideYalruySgq90ybZyh5RJ6hyN6yceC9BY9xcP9z f5FzAM6JkPqBaJfNl148imQpxbuWIcEgKwW+zeHAP8My3I56nMMI X-Google-Smtp-Source: AGHT+IH8IH6eNibf/hlkMPPL61IOqjHUilTsMePPIXC2WFI/2NHD6QF6KtwLczXmLcRnCJE+71f8vg== X-Received: by 2002:a2e:b890:0:b0:2e1:d6d5:634b with SMTP id r16-20020a2eb890000000b002e1d6d5634bmr1709856ljp.29.1714662002470; Thu, 02 May 2024 08:00:02 -0700 (PDT) Received: from [1.0.0.7] ([178.155.23.194]) by smtp.gmail.com with ESMTPSA id y23-20020a2e7d17000000b002d4295d8563sm208436ljc.62.2024.05.02.08.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 May 2024 08:00:02 -0700 (PDT) Message-ID: <83bfef0d-3e3c-e4c7-f6c4-29db5e632883@gmail.com> Date: Thu, 2 May 2024 18:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: cataloguing NOT NULL constraints Content-Language: en-US To: Alvaro Herrera Cc: Dean Rasheed , Andrew Bille , Peter Eisentraut , Robert Haas , pgsql-hackers@lists.postgresql.org References: <202405011749.txscey5apbn6@alvherre.pgsql> From: Alexander Lakhin In-Reply-To: <202405011749.txscey5apbn6@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Alvaro, 01.05.2024 20:49, Alvaro Herrera wrote: > Here are two patches that I intend to push soon (hopefully tomorrow). > Thank you for fixing those issues! Could you also clarify, please, how CREATE TABLE ... LIKE is expected to work with NOT NULL constraints? I wonder whether EXCLUDING CONSTRAINTS (ALL) should cover not-null constraints too. What I'm seeing now, is that: CREATE TABLE t1 (i int, CONSTRAINT nn NOT NULL i); CREATE TABLE t2 (LIKE t1 EXCLUDING ALL); \d+ t2 -- ends with: Not-null constraints:     "nn" NOT NULL "i" Or a similar case with PRIMARY KEY: CREATE TABLE t1 (i int PRIMARY KEY); CREATE TABLE t2 (LIKE t1 EXCLUDING CONSTRAINTS EXCLUDING INDEXES); \d+ t2 -- leaves: Not-null constraints:     "t2_i_not_null" NOT NULL "i" Best regards, Alexander