From: | Zhihong Yu <zyu(at)yugabyte(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | runtime error copying oids field |
Date: | 2020-11-30 22:29:11 |
Message-ID: | CALNJ-vSdhwSM5f4tnNn1cdLHvXMVe_S+V3nR5GwNrmCPNB2VtQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
In our testPgRegressTrigger test log, I saw the following (this was for a
relatively old version of PG):
197859 [ts-1]
../../../../../../src/postgres/src/backend/commands/indexcmds.c:1062:22:
runtime error: null pointer passed as argument 2, which is declared to
never be null
197860 [ts-1]
/opt/yb-build/brew/linuxbrew-20181203T161736v9/include/string.h:43:28:
note: nonnull attribute specified here
197861 [ts-1] #0 0xacbd0f in DefineIndex
$YB_SRC_ROOT/src/postgres/src/backend/commands/../../../../../../src/postgres/src/backend/commands/indexcmds.c:1062:4
197862 [ts-1] #1 0x11441e0 in ProcessUtilitySlow
$YB_SRC_ROOT/src/postgres/src/backend/tcop/../../../../../../src/postgres/src/backend/tcop/utility.c:1436:7
197863 [ts-1] #2 0x114141f in standard_ProcessUtility
$YB_SRC_ROOT/src/postgres/src/backend/tcop/../../../../../../src/postgres/src/backend/tcop/utility.c:962:4
197864 [ts-1] #3 0x1140b65 in YBProcessUtilityDefaultHook
$YB_SRC_ROOT/src/postgres/src/backend/tcop/../../../../../../src/postgres/src/backend/tcop/utility.c:3574:3
197865 [ts-1] #4 0x7f47d4950eac in pgss_ProcessUtility
$YB_SRC_ROOT/src/postgres/contrib/pg_stat_statements/../../../../../src/postgres/contrib/pg_stat_statements/pg_stat_statements.c:1120:4
This was the line runtime error was raised:
memcpy(part_oids, partdesc->oids, sizeof(Oid) * nparts);
From RelationBuildPartitionDesc we can see that:
if (nparts > 0)
{
PartitionBoundInfo boundinfo;
int *mapping;
int next_index = 0;
result->oids = (Oid *) palloc0(nparts * sizeof(Oid));
The cause was oids field was not assigned due to nparts being 0.
This is verified by additional logging added just prior to the memcpy call.
I want to get the community's opinion on whether a null check should be
added prior to the memcpy() call.
Cheers
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-11-30 22:29:51 | Re: [BUG] orphaned function |
Previous Message | Pavel Stehule | 2020-11-30 21:56:34 | Re: proposal: unescape_text function |