Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5a1d1b9

Browse files
committed
Avoid memcpy() with a NULL source pointer and count == 0
When memcpy() is called on a pointer, the compiler is entitled to assumethat the pointer is not null, which can lead to optimizing nearby codein potentially undesirable ways. We still want such optimizations(gcc's -fdelete-null-pointer-checks) in cases where they're valid.Related: commit13bba02.Backpatch to pg11, where this particular instance appeared.Reported-by: Ranier Vilela <ranier.vf@gmail.com>Reported-by: Zhihong Yu <zyu@yugabyte.com>Discussion:https://postgr.es/m/CAEudQApUndmQkr5fLrCKXQ7+ib44i7S+Kk93pyVThS85PnG3bQ@mail.gmail.comDiscussion:https://postgr.es/m/CALNJ-vSdhwSM5f4tnNn1cdLHvXMVe_S+V3nR5GwNrmCPNB2VtQ@mail.gmail.com
1 parentfd3a75d commit5a1d1b9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/backend/commands/indexcmds.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,15 +1140,17 @@ DefineIndex(Oid relationId,
11401140

11411141
if (partitioned)
11421142
{
1143+
PartitionDescpartdesc;
1144+
11431145
/*
11441146
* Unless caller specified to skip this step (via ONLY), process each
11451147
* partition to make sure they all contain a corresponding index.
11461148
*
11471149
* If we're called internally (no stmt->relation), recurse always.
11481150
*/
1149-
if (!stmt->relation||stmt->relation->inh)
1151+
partdesc=RelationGetPartitionDesc(rel);
1152+
if ((!stmt->relation||stmt->relation->inh)&&partdesc->nparts>0)
11501153
{
1151-
PartitionDescpartdesc=RelationGetPartitionDesc(rel);
11521154
intnparts=partdesc->nparts;
11531155
Oid*part_oids=palloc(sizeof(Oid)*nparts);
11541156
boolinvalidate_parent= false;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp