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 1nhVDb-00019h-Uk for pgsql-hackers@arkaria.postgresql.org; Thu, 21 Apr 2022 11:43:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nhVDa-0001Id-Bu for pgsql-hackers@arkaria.postgresql.org; Thu, 21 Apr 2022 11:43:26 +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 1nhVDZ-0001IT-JR for pgsql-hackers@lists.postgresql.org; Thu, 21 Apr 2022 11:43:26 +0000 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nhVDW-0002H3-6G for pgsql-hackers@postgresql.org; Thu, 21 Apr 2022 11:43:24 +0000 Received: by mail-ot1-x331.google.com with SMTP id 88-20020a9d0ee1000000b005d0ae4e126fso3099397otj.5 for ; Thu, 21 Apr 2022 04:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s2zr16v+CIO+tKwro5XmR9q3Z2bwp/Rn9UnT6w83/Js=; b=BZApXaOkJpP3PLMUfwo4p8zLdMQYrn5roTVb9Tmeo4cKBWWvVpwrZd2MtZIb3e/kex vNOifWMM7Q1G6ZXqtnCzXD7b4ktTM9IpXJDUZSE5MdOqNQhH8opcTyLx4csFcPv7XK16 JVQd9M0IKtkwR6pZj9XHDY1u0Guem7GqOp1gleEU0Q18afeY8NsxQTq6s1o/ezz0fJGi e8zu/R9vNvo/x2bLchsfmYdcNF8OztMcm2qDMvQVdcVCjxoCfC18sXhdpJWNgNnC73Xf PMwLNX4DlNfI/vkthE/1nq8qj+KGeG4Me80fASSSIfKkrbwKXIz6VRSZkttADVPwJ5C+ b1XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=s2zr16v+CIO+tKwro5XmR9q3Z2bwp/Rn9UnT6w83/Js=; b=V9uzPH1X7NBHKmkOburhewrARTGD7YcmAhRkv+3ic/x5uSPz3/rvAWoE11N1QlQOgz ANwvXnMDHzYim7+ezMfVMQjvlwi3+lkw35lSmhJjNeZG0QbVLJZbFZxLzUl0+Kwpjgor /3gIq6lnRsE/92GOSCJZasESgsIO9FxgqL6e0M6Eck7c0jCBf+CRYpflvFlNzp2glcMz ENh45Zk12COEu6j67LkkU/4GUScBFS3SNsXlb/jLrGZNsJAyj7DMlxKXg56gPOuG2eLT s78R/6LnHx4ilHYMhAAZGT7p3AeZJVwJL2aw7Rgv2Yz5lj49cE/seD8wBkxHZchotu+W +YPg== X-Gm-Message-State: AOAM531MLyrW3sd/w/Yt/C8CLND1/ZsdZdpleYeZFQMF4P/kvLzbsaxE sZJYq3X1ECXkqeLQy3lwM5FtddBTEeGNF1tN5I3boS6OsDfo3kIfkaTUUKuTW3uT5AYP8BGo2og 4JzJpN0RYDzwqT2vzPV04F6YVj1mL425udvBKHI6QyWY9ozORnAgF+0nxUC9lgVXLH5BU7oL315 au1/BmSUTRDWvYr73ESlzZPc9gVlqit+lFxuRnvktLk0hne+BjOjQbhgGlqk9c X-Google-Smtp-Source: ABdhPJwUIecPVQRawQC/sdFw3IImjxMC20aIVW5N+fapUky5mnNERJRgr9bPGvYM6j+r/O9mJSthA2XlzhRfKV7hJNw= X-Received: by 2002:a05:6830:18e2:b0:605:49d3:639b with SMTP id d2-20020a05683018e200b0060549d3639bmr7603941otf.382.1650541401174; Thu, 21 Apr 2022 04:43:21 -0700 (PDT) MIME-Version: 1.0 References: <2379840.1650314887@sss.pgh.pa.us> <62224288-cbc0-a759-4ff6-40baa32943eb@enterprisedb.com> In-Reply-To: <62224288-cbc0-a759-4ff6-40baa32943eb@enterprisedb.com> From: Simon Riggs Date: Thu, 21 Apr 2022 12:43:10 +0100 Message-ID: Subject: Re: Dump/Restore of non-default PKs To: Peter Eisentraut Cc: Tom Lane , "David G. Johnston" , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 20 Apr 2022 at 21:46, Peter Eisentraut wrote: > > On 18.04.22 22:48, Tom Lane wrote: > >> Why not just get rid of the limitation that constraint definitions don't > >> support non-default methods? > > That approach would be doubling down on the assumption that we can always > > shoehorn more custom options into SQL-standard constraint clauses, and > > we'll never fall foul of shift/reduce problems or future spec additions. > > When we do get the ability to create a table with a primary key with an > underlying hash index, how would that be done? Would the only way be > > 1. create the table without primary key > 2. create the index > 3. attach the index as primary key constraint > > That doesn't sound attractive. Can you explain what you find unattractive about it? The alternative is we have this 1. create the table without primary key 2. attach the index as primary key constraint (which must be extended to include ALL of the options available on create index) Having to extend ALTER TABLE so it exactly matches CREATE INDEX is painful and maintaining it that way seems unattractive, to me. Just so we are clear this is not about hash indexes, this is about using ANY kind of index (i.e. any index access method, extension or otherwise) to enforce a constraint. Another idea might be to allow some kind of statement embedding... so we don't need to constantly fiddle with ALTER TABLE ALTER TABLE foo ADD PRIMARY KEY USING INDEX (CREATE INDEX .... ) -- Simon Riggs http://www.EnterpriseDB.com/