Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyide-0001Kn-Qf for pgsql-bugs@arkaria.postgresql.org; Sat, 08 Sep 2018 19:11:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fyidc-000312-Kz for pgsql-bugs@arkaria.postgresql.org; Sat, 08 Sep 2018 19:11:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyidc-00030v-Eu for pgsql-bugs@lists.postgresql.org; Sat, 08 Sep 2018 19:11:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyidZ-0006cr-TS for pgsql-bugs@lists.postgresql.org; Sat, 08 Sep 2018 19:11:20 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w88JBFgQ004422; Sat, 8 Sep 2018 15:11:15 -0400 From: Tom Lane To: Andrew Gierth cc: Jeremy Evans , Michael Paquier , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15367: Crash in pg_fe_scram_free when using foreign tables In-reply-to: <3979.1536433320@sss.pgh.pa.us> References: <153626613985.23143.4743626885618266803@wrigleys.postgresql.org> <20180906215836.GP2726@paquier.xyz> <20180906222843.GF17425@jeremyevans.local> <20180907165103.GH17425@jeremyevans.local> <20180907175518.GI17425@jeremyevans.local> <20180907181522.GB32058@paquier.xyz> <20016.1536351535@sss.pgh.pa.us> <20180907204403.GC32058@paquier.xyz> <16558.1536407783@sss.pgh.pa.us> <18398.1536410055@sss.pgh.pa.us> <87o9d8rv08.fsf@news-spur.riddles.org.uk> <3979.1536433320@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 08 Sep 2018 15:02:00 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4420.1536433875.1@sss.pgh.pa.us> Date: Sat, 08 Sep 2018 15:11:15 -0400 Message-ID: <4421.1536433875@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > I tried setting up a scram-auth-based postgres_fdw connection on > my RHEL6 box and forcing it through the questionable code path > by issuing a dummy ALTER USER MAPPING command from another session. > It worked fine, so the problem doesn't seem to be present on Linux. Oh, I meant to show the test I used, for the benefit of anyone who wants to test on other platforms. Do this (with adjustments to taste) to set up: set password_encryption = "scram-sha-256" ; create user u1 password 'foobar'; create extension postgres_fdw; create server loopback foreign data wrapper postgres_fdw options (host 'localhost', dbname 'postgres'); create user mapping for u1 server loopback options (user 'u1', password 'foobar'); grant usage on foreign server loopback to u1; \c - u1 create table remote (f1 int); insert into remote values(1),(2); create foreign table localt (f1 int) server loopback options (table_name 'remote'); At this point you should be able to do select * from localt; as u1; if not, adjust pg_hba.conf to require a password on localhost connections. Once the select works, *leave that session open*, and in another session do any no-op ALTER on the user mapping, such as alter user mapping for u1 server loopback options (set user 'u1'); Now, in the first session, repeat select * from localt; It'll dump core with a backtrace similar to what Jeremy showed, if the bug is present. regards, tom lane