Re: map_partition_varattnos() and whole-row vars
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Amit Khandekar <amitdkhan.pg@gmail.com>
Cc: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-08-03T05:30:06Z
Lists: pgsql-hackers
Attachments
- 0001-Fix-map_partition_varattnos-to-not-error-on-found_wh-v2.patch (text/plain) patch v2-0001
- 0002-Teach-map_variable_attnos_mutator-to-convert-whole-r-v2.patch (text/plain) patch v2-0002
Thanks for the review. On 2017/08/03 13:54, Amit Khandekar wrote: > On 2 August 2017 at 11:51, Amit Langote wrote: >> On 2017/08/02 1:33, Amit Khandekar wrote: >>> Instead of callers of map_partition_varattnos() reporting error, we >>> can have map_partition_varattnos() itself report error. Instead of the >>> found_whole_row parameter of map_partition_varattnos(), we can have >>> error_on_whole_row parameter. So callers who don't expect whole row, >>> would pass error_on_whole_row=true to map_partition_varattnos(). This >>> will simplify the resultant code a bit. >> >> So, I think it's only the callers of >> map_partition_varattnos() who know whether finding whole-row vars is an >> error and *what kind* of error. > > Ok. Got it. Thanks for the explanation. > > How about making found_whole_row as an optional parameter ? > map_partition_varattnos() would populate it only if its not NULL. This > way, callers who don't bother about whether it is found or not don't > have to declare a variable and pass its address. In current code, > ExecInitModifyTable() is the one who has to declare found_whole_row > without needing it. Sure, done. But while implementing that, I avoided changing anything in map_variable_attnos(), such as adding a check for not-NULLness of found_whole_row. The only check added is in map_partition_varattnos(). Attached updated patches. Thanks, Amit
Commits
-
Teach map_partition_varattnos to handle whole-row expressions.
- 610e8ebb0fad 10.0 landed