pgdump_seclabel.diff
text/x-patch
Filename: pgdump_seclabel.diff
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/bin/pg_dump/pg_dump.c | 0 | 0 |
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index fce9d3b..9e31767 100644
*** a/src/bin/pg_dump/pg_dump.c
--- b/src/bin/pg_dump/pg_dump.c
*************** findSecLabels(Archive *fout, Oid classoi
*** 11760,11766 ****
/* Get security labels if we didn't already */
if (nlabels < 0)
nlabels = collectSecLabels(fout, &labels);
!
/*
* Do binary search to find some item matching the object.
*/
--- 11760,11770 ----
/* Get security labels if we didn't already */
if (nlabels < 0)
nlabels = collectSecLabels(fout, &labels);
! if (nlabels == 0)
! {
! *items=NULL;
! return 0;
! }
/*
* Do binary search to find some item matching the object.
*/
*************** collectSecLabels(Archive *fout, SecLabel
*** 11858,11875 ****
i_objsubid = PQfnumber(res, "objsubid");
ntups = PQntuples(res);
!
! labels = (SecLabelItem *) malloc(ntups * sizeof(SecLabelItem));
!
! for (i = 0; i < ntups; i++)
{
! labels[i].label = PQgetvalue(res, i, i_label);
! labels[i].provider = PQgetvalue(res, i, i_provider);
! labels[i].classoid = atooid(PQgetvalue(res, i, i_classoid));
! labels[i].objoid = atooid(PQgetvalue(res, i, i_objoid));
! labels[i].objsubid = atoi(PQgetvalue(res, i, i_objsubid));
}
/* Do NOT free the PGresult since we are keeping pointers into it */
destroyPQExpBuffer(query);
--- 11862,11889 ----
i_objsubid = PQfnumber(res, "objsubid");
ntups = PQntuples(res);
! if ( ntups == 0)
{
! labels = NULL;
}
+ else
+ {
+ labels = (SecLabelItem *) malloc(ntups * sizeof(SecLabelItem));
+ if (labels == NULL )
+ {
+ write_msg(NULL, "out of memory");
+ exit(1);
+ }
+ for (i = 0; i < ntups; i++)
+ {
+ labels[i].label = PQgetvalue(res, i, i_label);
+ labels[i].provider = PQgetvalue(res, i, i_provider);
+ labels[i].classoid = atooid(PQgetvalue(res, i, i_classoid));
+ labels[i].objoid = atooid(PQgetvalue(res, i, i_objoid));
+ labels[i].objsubid = atoi(PQgetvalue(res, i, i_objsubid));
+ }
+ }
/* Do NOT free the PGresult since we are keeping pointers into it */
destroyPQExpBuffer(query);