On 2018-Jun-09, David Rowley wrote: > On 9 June 2018 at 03:24, Alvaro Herrera <alvhe...@2ndquadrant.com> wrote: > > I was also wondering about introducing a new function call in this path > > where previously was none. Given the amount of other stuff that's > > happening when a tuple is inserted, I suppose it's not worth worrying > > about in terms of making this an inline function in the header. > > I wondered about that too. I've not tested it again, but I do have > another patch locally which can about double the speed of COPY FROM > for partitioned tables, so I have to admit I did gawk at the > additional function call idea, but I'd rather see this fixed than on > the shelf, so I went with it. > > I'll leave it up to you to how you'd like to format the if statement. > I've written it the way I'm happy with.
Truth is, the more I look at this, the more I think it should be done in the way Amit Langote was proposing: do away with the extra function, and check all those conditions inside ExecConstraints itself. We can add a new boolean tupleRouting argument, which I think is the only missing bit. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services