pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: Bartosz Polnik <bartoszpolnik@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #15577: Query returns different results when executed multiple times
Date: Wed, 09 Jan 2019 18:09:36 -0500
Message-ID: <31333.1547075376@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEepm=2KvDWQbQCHdUW5hznvpzFHUf=htj=RwBjCcHhkgBnPVA@mail.gmail.com>
References: <15577-ca61ab18904af852@postgresql.org>
	<CAKJS1f8kLijpf-EKHLL7yJ2KJy9-FWNQfXBuNtToVTPkW_Ue+w@mail.gmail.com>
	<CAM37Zev2xUezKc0XZFPfi=BtH+of+fqTAYUCJJuf+4Pc6u4G7g@mail.gmail.com>
	<CAEepm=0yv2qNDM_JfiakqQO3EqYNhQZjNCAX=fK8Cuhz6_RO4Q@mail.gmail.com>
	<CAM37ZetJ-R5De+aTfZV8+BE_KzqbajF3gjv_t1DGsS853aDc0Q@mail.gmail.com>
	<CAEepm=15_MWhhp-Pg6rW1whuXrBTJ-gM=w+2t-Qk-VQHgniG0w@mail.gmail.com>
	<CAM37ZevSHt0pdKhZ_Bu7nDoMMWSDsJaaPUPR_ApowoFida4fcA@mail.gmail.com>
	<CAEepm=1QU7HpJSGhBkfFwKC_wW6fCTADeHymA7ngzszJRM39bw@mail.gmail.com>
	<CAM37Zeu1gv=PswA-C4WeCN13KrrXcD9s1mTdaTuVTKjV=aLoiA@mail.gmail.com>
	<CAEepm=34FwV5W3qoz29_bS1uodKkN1wS-P_9V429JUjjGKwopg@mail.gmail.com>
	<CAM37ZeuWGV_58O8MeH0TfqBiK0JUONPhHs2=YM2MR61K2E=v9Q@mail.gmail.com>
	<CAKJS1f8OZteLVbmKyoTuC7wY=fzZ+jW=gFV=0NoXS0AvfbOZ2g@mail.gmail.com>
	<CAEepm=2MYvOvsA7YY-9kU0JT-2Bn51N-YjGq1mDi4GOeR=0nJA@mail.gmail.com>
	<CAEepm=3s70u7-E9aSdsSq+_S_cm2GnT4Tk3_vC81PDxe=hCFRw@mail.gmail.com>
	<CAKJS1f_-bU1rMby_qYXOvyAf9Mz8JEojA2tat1! iU7mhdrySYoA@mail.gmail.com>
	<CAEepm=3q=22Stv6QTR+ijWorWYMFRPC=T=hM9iJPMxgpTOE55A@mail.gmail.com>
	<CAM37Zeshup0OkzJ2z=8_jBPrv-=dQZvs+v0HDmKnFf4wLn7jzQ@mail.gmail.com>
	<CAEepm=0eviDVN2n=Dr7FegnJ69w3Z+EaB=CBV5Y9HXLN_HwXKQ@mail.gmail.com>
	<CAEepm=2UuWkK-tUZMK=SqJ8Qn3jX0jTpE=wk5KKSSJB0gYzSXQ@mail.gmail.com>
	<CAKJS1f8zFL8539hpy_gBV3JOcNRqhb1wVVhuVkp_H_E_qJU_iw@mail.gmail.com>
	<CAEepm=0ZqJp2nXRZf8e9ys6Utyu96QVy0=L8Q=-2UoDxwY=smA@mail.gmail.com>
	<87k1jdpniz.fsf@news-spur.riddles.org.uk>
	<CAEepm=2KvDWQbQCHdUW5hznvpzFHUf=htj=RwBjCcHhkgBnPVA@mail.gmail.com>

Thomas Munro <thomas.munro@enterprisedb.com> writes:
> On Thu, Jan 10, 2019 at 10:04 AM Andrew Gierth
> <andrew@tao11.riddles.org.uk> wrote:
>> But clearly this can't work if one param is referenced both inside and
>> outside a Gather, because while they will compare equal for Vars, they
>> won't actually have the same value thanks to rows coming in from
>> workers.

> But if they used different params, there could be different problems,
> no?  It's logically the same var.

As far as I can think at the moment, there's no problem with having
multiple nestloop Params referencing the "same" Var.  It could be an
impediment to optimization if it happened (much) earlier in the planner,
but for the situation at hand the only code that's going to be looking
at the tree is the executor and maybe ruleutils, both of which are much
too stupid to be bothered by such aliasing.

> This makes me wonder if we need
> some kind of scheme for saving and restoring affected params whenever
> Gather switches between executing the plan directly and emitting
> tuples from workers, or something like that...

I don't think we need to (or should) go there if this is the only
problem.  What's worrying me is what other assumptions based on serial
plan execution are getting broken by injecting Gather into mid levels
of a plan tree.

			regards, tom lane




view thread (37+ messages)  latest in thread

Message-ID: <31333.1547075376@sss.pgh.pa.us>
Permalink:  ../31333.1547075376@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/31333.1547075376@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, thomas.munro@enterprisedb.com, andrew@tao11.riddles.org.uk, david.rowley@2ndquadrant.com, bartoszpolnik@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15577: Query returns different results when executed multiple times
  In-Reply-To: <31333.1547075376@sss.pgh.pa.us>

* 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