pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Lakhin <exclusion@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org, tom@intevation.de, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Subject: Re: BUG #16272: Index expression can refer to wrong attributes if index is created via CREATE TABLE LIKE
Date: Sun, 13 Sep 2020 10:00:01 +0300
Message-ID: <05051f9d-b32b-cb35-6735-0e9f2ab86b5f@gmail.com> (raw)
In-Reply-To: <20200822014121.GC2108@paquier.xyz>
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>

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=<optimized out>) 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=<optimized out>) 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=<optimized out>,
    setHoldSnapshot=<optimized out>, 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=<optimized out>,
argv=argv@entry=0x561be8f81868, dbname=<optimized out>,
    username=<optimized out>) 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=<optimized out>,
argv=0x561be8f508c0) at postmaster.c:1412
#16 0x0000561be6a0e1f2 in main (argc=3, argv=0x561be8f508c0) at main.c:210

Best regards,
Alexander





view thread (7+ messages)  latest in thread

Message-ID: <05051f9d-b32b-cb35-6735-0e9f2ab86b5f@gmail.com>
Permalink:  ../05051f9d-b32b-cb35-6735-0e9f2ab86b5f@gmail.com/
Also on:    postgresql.org/message-id/05051f9d-b32b-cb35-6735-0e9f2ab86b5f@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: exclusion@gmail.com, michael@paquier.xyz, tgl@sss.pgh.pa.us, peter.eisentraut@2ndquadrant.com
  Subject: Re: BUG #16272: Index expression can refer to wrong attributes if index is created via CREATE TABLE LIKE
  In-Reply-To: <05051f9d-b32b-cb35-6735-0e9f2ab86b5f@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox