Code review for make_partition_op_expr.
authorRobert Haas
Wed, 17 May 2017 18:31:48 +0000 (14:31 -0400)
committerRobert Haas
Wed, 17 May 2017 18:31:48 +0000 (14:31 -0400)
It's better to use the actual keynum here rather than 0, because
someday someone might try to make list partitioning work with
multiple partitioning columns.

Jeevan Ladhe

Discussion: http://postgr.es/m/CAOgcT0M6-mx+dSX47JGJuJP1CKr4XssBFVmKNETt0OZYWpFr+w@mail.gmail.com

src/backend/catalog/partition.c

index 2e9b727fe78f5a686e9894dfc7d94a3d4d0a4168..acd9f2d273e9cd829d8a77e7be89606c0e158b6d 100644 (file)
@@ -1266,7 +1266,7 @@ make_partition_op_expr(PartitionKey key, int keynum,
                saopexpr->opno = operoid;
                saopexpr->opfuncid = get_opcode(operoid);
                saopexpr->useOr = true;
-               saopexpr->inputcollid = key->partcollation[0];
+               saopexpr->inputcollid = key->partcollation[keynum];
                saopexpr->args = list_make2(arg1, arg2);
                saopexpr->location = -1;