From: Julien Rouhaud <julien.rouhaud@dalibo.com>
To: Michael Paquier <michael.paquier@gmail.com>
To: Stefan Huehner <stefan@huehner.org>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Subject: Re: pg9.6 segfault using simple query (related to use fk for join estimates)
Date: Fri, 29 Apr 2016 17:59:19 +0200
Message-ID: <572384D7.1020602@dalibo.com> (raw)
In-Reply-To: <CAB7nPqRj2EsGdoNESsWVC-RHV918Scd1xQEcYt3dK9Rs5RpuAQ@mail.gmail.com>
References: <20160429102531.GA13701@huehner.biz>
<CAB7nPqRj2EsGdoNESsWVC-RHV918Scd1xQEcYt3dK9Rs5RpuAQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 29/04/2016 13:20, Michael Paquier wrote:
> On Fri, Apr 29, 2016 at 7:25 PM, Stefan Huehner <stefan@huehner.org> wrote:
>> If you need any more info or testing done just let me know.
>
> The information you are providing is sufficient to reproduce the
> problem, thanks! I have added this bug to the list of open items for
> 9.6.
>
The segfault is caused by quals_match_foreign_key() calling get_leftop()
and get_rightop() on a ScalarArrayOpExpr node.
Reordering the common fields of OpExpr and ScalarArrayOpExpr at the
beginning of the struct so the get_*op() work with either (as in
attached patch) fixes the issue.
I'm not sure that assuming this compatibility is the right way to fix
this though.
--
Julien Rouhaud
http://dalibo.com - http://dalibo.org
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:reorder_opexpr.diff (text/plain, 1.3K) downloaddiff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.hindex 1ffc0a1..dffe129 100644--- a/src/include/nodes/primnodes.h+++ b/src/include/nodes/primnodes.h@@ -468,12 +468,12 @@ typedef struct OpExpr
Expr xpr;
Oid opno; /* PG_OPERATOR OID of the operator */
Oid opfuncid; /* PG_PROC OID of underlying function */
- Oid opresulttype; /* PG_TYPE OID of result value */- bool opretset; /* true if operator returns set */- Oid opcollid; /* OID of collation of result */
Oid inputcollid; /* OID of collation that operator should use */
List *args; /* arguments to the operator (1 or 2) */
int location; /* token location, or -1 if unknown */
+ Oid opresulttype; /* PG_TYPE OID of result value */+ bool opretset; /* true if operator returns set */+ Oid opcollid; /* OID of collation of result */
} OpExpr;
/*
@@ -511,10 +511,10 @@ typedef struct ScalarArrayOpExpr
Expr xpr;
Oid opno; /* PG_OPERATOR OID of the operator */
Oid opfuncid; /* PG_PROC OID of underlying function */
- bool useOr; /* true for ANY, false for ALL */
Oid inputcollid; /* OID of collation that operator should use */
List *args; /* the scalar and array operands */
int location; /* token location, or -1 if unknown */
+ bool useOr; /* true for ANY, false for ALL */
} ScalarArrayOpExpr;
/*
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: julien.rouhaud@dalibo.com, michael.paquier@gmail.com, stefan@huehner.org, tomas.vondra@2ndquadrant.com
Subject: Re: pg9.6 segfault using simple query (related to use fk for join estimates)
In-Reply-To: <572384D7.1020602@dalibo.com>
References: <20160429102531.GA13701@huehner.biz> <CAB7nPqRj2EsGdoNESsWVC-RHV918Scd1xQEcYt3dK9Rs5RpuAQ@mail.gmail.com> <572384D7.1020602@dalibo.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