Re: map_partition_varattnos() and whole-row vars

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: map_partition_varattnos() and whole-row vars
Date: 2017-07-28 05:47:56
Message-ID: d86d27ea-cc9d-5dbe-b131-e7dec4017983@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017/07/26 16:58, Amit Langote wrote:
> Rajkumar Raghuwanshi reported [1] on the "UPDATE partition key" thread
> that whole-row vars don't play nicely with partitioned table operations.
>
> For example, when used to convert WITH CHECK OPTION constraint expressions
> and RETURNING target list expressions, it will error out if the
> expressions contained whole-row vars. That's a bug, because whole-row
> vars are legal in those expressions. I think the decision to output error
> upon encountering a whole-row in the input expression was based on the
> assumption that it will only ever be used to convert partition constraint
> expressions, which cannot contain those. So, we can relax that
> requirement so that its other users are not bitten by it.
>
> Attached fixes that.

Attached a revised version of the patch.

Updated patch moves the if (found_whole_row) elog(ERROR) bit in
map_partition_varattnos to the callers. Only the callers know if
whole-row vars are not expected in the expression it's getting converted
from map_partition_varattnos. Given the current message text (mentioning
"partition key"), it didn't seem appropriate to have the elog inside this
function, since it's callable from places where it wouldn't make sense.

Thanks,
Amit

Attachment Content-Type Size
0001-Fix-map_partition_varattnos-to-sometimes-accept-whol.patch text/plain 9.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2017-07-28 06:15:16 Re: Missing comment for max_logical_replication_workers in postgresql.conf.sample
Previous Message Noah Misch 2017-07-28 05:30:49 Re: [bug fix] PG10: libpq doesn't connect to alternative hosts when some errors occur