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 1kHLzh-0002f7-6H for pgsql-bugs@arkaria.postgresql.org; Sun, 13 Sep 2020 07:00:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kHLzf-00009l-PM for pgsql-bugs@arkaria.postgresql.org; Sun, 13 Sep 2020 07:00:11 +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 1kHLzf-00009U-Hl for pgsql-bugs@lists.postgresql.org; Sun, 13 Sep 2020 07:00:11 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kHLzZ-0006J7-3m for pgsql-bugs@lists.postgresql.org; Sun, 13 Sep 2020 07:00:11 +0000 Received: by mail-lf1-x144.google.com with SMTP id m5so10074875lfp.7 for ; Sun, 13 Sep 2020 00:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=wt4QRcoGytEyFiXzwmOMNRxCKg+XImFyPaU1og3sJtE=; b=R4eKuiEy262WGC4X42ARkwjcXzN6hQagpOUQLeZT0KF9wCUXpqU3rnFx61QgenD8b3 HEnSlgd1HgqhZKVsvtt6ytrcdEE8LSsKApDE/Qk+sqTY2hOvsXr+VcjP9T8hCw7tc0ML Z9PPx1s2cAzAYuhT8fabKfMYfCCfyr16WZNnT8HpavIgXmT/6U159Imil3a56l9K2Ulk f4iu2Wp2Dqw4EaerjfnRcvTz6GPK/g0x+1CEonD2Rs+CalSDxoRtcZACMZncCjg8XNUv pTecpLQxt7oK/oZBSNvKate7UCbGROYLIUO69j6tG3kTrGL+W3TqlVxaEaBEqE9dJhgl VmxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=wt4QRcoGytEyFiXzwmOMNRxCKg+XImFyPaU1og3sJtE=; b=rEGIwKk7H/0F2pL1Ndfu9TGj8ieJhGmhoDyyimHEdxF3ajJDEowrEIhdJQib4nwUnT r+1p8pjGoHDXQ8IPBcp7ZhfbtkqaufE0/CbinXaXSAhlWRiUO2u5EDRhO7INgC13TPBa 2bkSzt0cF2HduM/fphHT+tCNH4IfqnKwtJXcYVra7ObhxOwGTcnjNP3VKYKUNW7EGa1J t3dfQoeZfzdQOcPcMnV6or2a66vtc1ZdbCaB6dijpbzPTVtaKDjJ5SP44W40lYYnPfT6 upXGMKn+l7NCt2XExWIe/BYvc1ZVWNo9kd/O+9BeJGgSO46d8yl5rKJdQowLiBSb+SR/ P+0A== X-Gm-Message-State: AOAM533YcxxVn+cwmwWk5i9+Hixe5zrhvGVMssbK4E7wCAkO2CwLSHKy iqVDQz4eABR2OH3uPTJ+nUI= X-Google-Smtp-Source: ABdhPJz7c2Cfv9fVG6aUFVXBuBwZeQnbwIXj2vCG7bWHqTHFo6eGCchFFU0B0Kmx4YnXiM4eu48OEg== X-Received: by 2002:a19:8708:: with SMTP id j8mr3027916lfd.266.1599980403322; Sun, 13 Sep 2020 00:00:03 -0700 (PDT) Received: from [1.0.0.7] ([178.155.6.231]) by smtp.gmail.com with ESMTPSA id k128sm1993585lfk.235.2020.09.13.00.00.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 13 Sep 2020 00:00:02 -0700 (PDT) Subject: Re: BUG #16272: Index expression can refer to wrong attributes if index is created via CREATE TABLE LIKE To: Michael Paquier , Tom Lane Cc: pgsql-bugs@lists.postgresql.org, tom@intevation.de, Peter Eisentraut References: <16272-6e32da020e9a9381@postgresql.org> <6861.1582328011@sss.pgh.pa.us> <8840.1587948815@sss.pgh.pa.us> <1727369.1597951104@sss.pgh.pa.us> <20200822014121.GC2108@paquier.xyz> From: Alexander Lakhin Message-ID: <05051f9d-b32b-cb35-6735-0e9f2ab86b5f@gmail.com> Date: Sun, 13 Sep 2020 10:00:01 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200822014121.GC2108@paquier.xyz> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello hackers, 22.08.2020 04:41, Michael Paquier wrote: > For the archive's sake, this has been committed as of 5028981, > backpatched down to 9.5. > -- > Michael I've encountered an issue (on REL_13_STABLE) that is attributed by `git bisect` to 894f5dea (5028981 on master). When executing the following query: CREATE TABLE test(i int CHECK (i > 0)); CREATE TABLE pg_user(LIKE test INCLUDING CONSTRAINTS); I get an assertion: Core was generated by `postgres: law regression [local] CREATE TABLE                                 '. Program terminated with signal SIGABRT, Aborted. #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1  0x00007f8872deb859 in __GI_abort () at abort.c:79 #2  0x0000561be6ee042b in ExceptionalCondition (     conditionName=conditionName@entry=0x561be6f3f120 "lockmode != NoLock || IsBootstrapProcessingMode() || CheckRelationLockedByMe(r, AccessShareLock, true)", errorType=errorType@entry=0x561be6f3d01d "FailedAssertion",     fileName=fileName@entry=0x561be6fe843f "relation.c", lineNumber=lineNumber@entry=68) at assert.c:67 #3  0x0000561be6a1e349 in relation_open (relationId=12098, lockmode=) at relation.c:68 #4  0x0000561be6b6b174 in expandTableLikeClause (heapRel=0x561be8f56e98,     table_like_clause=table_like_clause@entry=0x561be8f77440) at parse_utilcmd.c:1179 #5  0x0000561be6dafa90 in ProcessUtilitySlow (pstate=pstate@entry=0x561be8f771c0, pstmt=pstmt@entry=0x561be8f57120,     queryString=queryString@entry=0x561be8f56460 "CREATE TABLE pg_user(LIKE test INCLUDING CONSTRAINTS);",     context=context@entry=PROCESS_UTILITY_TOPLEVEL, params=params@entry=0x0, queryEnv=queryEnv@entry=0x0,     qc=0x7ffe509d76b0, dest=) at utility.c:1212 #6  0x0000561be6daec91 in standard_ProcessUtility (pstmt=0x561be8f57120,     queryString=0x561be8f56460 "CREATE TABLE pg_user(LIKE test INCLUDING CONSTRAINTS);",     context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x561be8f57400, qc=0x7ffe509d76b0)     at utility.c:1069 #7  0x0000561be6dac066 in PortalRunUtility (portal=0x561be8fb77e0, pstmt=0x561be8f57120, isTopLevel=,     setHoldSnapshot=, dest=0x561be8f57400, qc=0x7ffe509d76b0) at pquery.c:1157 #8  0x0000561be6dacb34 in PortalRunMulti (portal=portal@entry=0x561be8fb77e0, isTopLevel=isTopLevel@entry=true,     setHoldSnapshot=setHoldSnapshot@entry=false, dest=dest@entry=0x561be8f57400, altdest=altdest@entry=0x561be8f57400,     qc=qc@entry=0x7ffe509d76b0) at pquery.c:1303 #9  0x0000561be6dadabe in PortalRun (portal=portal@entry=0x561be8fb77e0, count=count@entry=9223372036854775807,     isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, dest=dest@entry=0x561be8f57400,     altdest=altdest@entry=0x561be8f57400, qc=0x7ffe509d76b0) at pquery.c:779 #10 0x0000561be6da905a in exec_simple_query (     query_string=0x561be8f56460 "CREATE TABLE pg_user(LIKE test INCLUDING CONSTRAINTS);") at postgres.c:1239 #11 0x0000561be6daaedc in PostgresMain (argc=, argv=argv@entry=0x561be8f81868, dbname=,     username=) at postgres.c:4315 #12 0x0000561be6d182cf in BackendRun (port=0x561be8f77ea0) at postmaster.c:4536 #13 BackendStartup (port=0x561be8f77ea0) at postmaster.c:4220 #14 ServerLoop () at postmaster.c:1739 #15 0x0000561be6d1921f in PostmasterMain (argc=, argv=0x561be8f508c0) at postmaster.c:1412 #16 0x0000561be6a0e1f2 in main (argc=3, argv=0x561be8f508c0) at main.c:210 Best regards, Alexander