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 1kNOHC-0003T2-Tu for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Sep 2020 22:39:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kNOHB-0004Oc-TF for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Sep 2020 22:39:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNOHB-0004NX-JP for pgsql-bugs@lists.postgresql.org; Tue, 29 Sep 2020 22:39:13 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kNOH8-0003cY-Ok for pgsql-bugs@postgresql.org; Tue, 29 Sep 2020 22:39:12 +0000 Received: by mail-qk1-x743.google.com with SMTP id c62so6182295qke.1 for ; Tue, 29 Sep 2020 15:39:10 -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=K914vx2HjK69cUoqKrmWH99YEsaAxAsRjpnl/R1leZg=; b=RYzNLMVtlMW9bSi4dH3d3V9B9P9J0wnQo2TRGs9UaO6ETR85abI/tUUoP7NLinNXdF CKNgYbO6jhjXliB+ng2NGPmT+UYrT6TBsib1p6CDAFSLlWkHb7/OzXplKEAcdjAVvu8+ IcJxZjEzzGvYt2CMhWjdytIWsrRim3nCDhlFzqaDGCOYjONaf0byqWSeliAqQz565s2U 4iaWj6VRiNyDZkqvUNZ6d55hZRXURC8OK6hA/VMC1hfT7pppukswiqMjZTolZKTiwc6i KMatruKSG5TQoVHbI8hp5Ofctf1gx6WhKFfXyJqkAQHwvNr896rD30Sbsm3c3zUBaCKR 7kxQ== 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=K914vx2HjK69cUoqKrmWH99YEsaAxAsRjpnl/R1leZg=; b=dehQcT6EIh5xHLAamA0TIxn2ZfVrRxXP9Fbm4plc0R6geD4lCVOeYcsQIaOxKhr5j+ US2+DgiyQEyJzL9mnLORSi1M5WsiEh8gw/a69E1kQ/qAeNfyRkItzY1iqnSlkhVxmz+a tGzQe4j+C50utHijUNriyALyWLvPemKmyPEmgcz0ApK9QtuDQAn3O6DAxe5dJXMc6eOy rUAIH+flW4jJEnoaT5tfWV8UIDKXYgjgHB4mSOKy0CFkIyGy1nzYf+1DKISSph0G4hPA vSqFctd9M4bqBrO7cKeWvLwFyVFDQjtiULaxqged5+5MEM8N7jv3qQmudcBEndUEpLcv JJDw== X-Gm-Message-State: AOAM533Iv+NT4vkJpsE+zWVUxvcHwiOCXhFAb2oLprVkFXg0GBJ3tKw7 OBPfqLr60OD1XybdedzH+aK4ig== X-Google-Smtp-Source: ABdhPJz2zuxZKJrhXid6X+82p1/7OmkKmfE3BawRtWWh+3pVl8rooKcEkErJFksRN4LGv8TBP/Bciw== X-Received: by 2002:a37:d51:: with SMTP id 78mr273575qkn.253.1601419149784; Tue, 29 Sep 2020 15:39:09 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.148]) by smtp.gmail.com with ESMTPSA id v28sm6146417qkv.72.2020.09.29.15.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 15:39:09 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 7E8282A14FE; Tue, 29 Sep 2020 19:39:07 -0300 (-03) Date: Tue, 29 Sep 2020 19:39:07 -0300 From: Alvaro Herrera To: Tom Lane Cc: David Rowley , Nagaraj Raj , Pg Bugs Subject: Re: ERROR: insufficient columns in the PRIMARY KEY constraint definition Message-ID: <20200929223907.GA14950@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <724329.1601418149@sss.pgh.pa.us> 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-Sep-29, Tom Lane wrote: > Indeed. However, this complaint shows that the error message is not clear > enough. I propose changing it to > > ERROR: unique constraint on partitioned table must be a superset of the partitioning columns > > or perhaps > > ERROR: unique constraint on partitioned table must include all partitioning columns Either of those work for me. How common is the word "superset" in English? We don't seem seem to use it either in error messages, though it does occur in docs. > > There's mention in [1] section 5.10.2.3. "Unique constraints on > > partitioned tables must include all the partition key columns. This > > limitation exists because PostgreSQL can only enforce uniqueness in > > each partition individually.". That text likely should also mention > > PRIMARY KEY constraints. That probably should be changed > > Meh. If you've read that bit you probably already understand that > pkeys are unique constraints. I think the problem is with the error > text not the docs. Maybe mention PKs in parens: "Unique constraints (and[, by extension,] primary key constraints) on partitioned tables must include all the partition key columns. This limitation exists because PostgreSQL can only enforce uniqueness in each partition individually.". That text likely should also mention PRIMARY KEY constraints. That probably should be changed -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services