Re: Unexpected result count from update statement on partitioned table

2020-12-18 Thread Tom Lane
Michael Lewis writes: > On Fri, Dec 18, 2020 at 12:16 PM Tom Lane wrote: >> Yeah, this is a fairly fundamental shortcoming in inheritance_planner(): >> it supposes that it can duplicate the whole query for each target table. > Are there other examples of gotchas with this? Would it be any volati

Re: Unexpected result count from update statement on partitioned table

2020-12-18 Thread Michael Lewis
On Fri, Dec 18, 2020 at 12:16 PM Tom Lane wrote: > Laurenz Albe writes: > > The subquery is executed twice, and the two executions obviously don't > > return the same results. I am at a loss for an explanation ... > > Yeah, this is a fairly fundamental shortcoming in inheritance_planner(): > it

Re: Unexpected result count from update statement on partitioned table

2020-12-18 Thread Tom Lane
Laurenz Albe writes: > The subquery is executed twice, and the two executions obviously don't > return the same results. I am at a loss for an explanation ... Yeah, this is a fairly fundamental shortcoming in inheritance_planner(): it supposes that it can duplicate the whole query for each targe

Re: Unexpected result count from update statement on partitioned table

2020-12-18 Thread Ron
Would (task_type in (1,2)) make any logical difference? On 12/18/20 6:11 AM, Craig McIlwee wrote: Despite looking at this query on and off for a couple of days, it wasn't until seeing it in Lauenz's reply that I noticed  a logical issue with the query that changes things a bit.  There should be

Re: Unexpected result count from update statement on partitioned table

2020-12-18 Thread Craig McIlwee
Despite looking at this query on and off for a couple of days, it wasn't until seeing it in Lauenz's reply that I noticed a logical issue with the query that changes things a bit. There should be parenthesis around the task_type predicates, otherwise you end up getting reserved rows in the result

Re: Unexpected result count from update statement on partitioned table

2020-12-18 Thread Laurenz Albe
On Thu, 2020-12-17 at 12:21 -0500, Craig McIlwee wrote: > Our application uses a queue-like table to assign tasks to users and this has > worked well for us for a few years. Now we are in the process of adding some > restrictions to which tasks a user can > work on and that is based on an attrib

Unexpected result count from update statement on partitioned table

2020-12-17 Thread Craig McIlwee
Hello, Our application uses a queue-like table to assign tasks to users and this has worked well for us for a few years. Now we are in the process of adding some restrictions to which tasks a user can work on and that is based on an attribute of each task that does not change for the task's lifes