[patch] some PQExpBuffer are not destroyed in pg_dump - Mailing list pgsql-hackers

From Zhang, Jie
Subject [patch] some PQExpBuffer are not destroyed in pg_dump
Date
Msg-id 05bcbc5857f948efa0b451b85a48ae10@G08CNEXMBPEKD06.g08.fujitsu.local
Whole thread Raw
Responses Re: [patch] some PQExpBuffer are not destroyed in pg_dump
List pgsql-hackers
Hi al

In getDefaultACLs function, some PQExpBuffer are not destroy

File: src/bin/pg_dump/pg_dump.c
DefaultACLInfo *
getDefaultACLs(Archive *fout, int *numDefaultACLs)
{
......
    if (fout->remoteVersion >= 90600)
    {
        PQExpBuffer acl_subquery = createPQExpBuffer();       // *** acl_subquery not destroyed ***
        PQExpBuffer racl_subquery = createPQExpBuffer();      // *** racl_subquery not destroyed ***
        PQExpBuffer initacl_subquery = createPQExpBuffer();   // *** initacl_subquery not destroyed ***
        PQExpBuffer initracl_subquery = createPQExpBuffer();  // *** initracl_subquery not destroyed ***

        buildACLQueries(acl_subquery, racl_subquery, initacl_subquery,
                        initracl_subquery, "defaclacl", "defaclrole",
                        "CASE WHEN defaclobjtype = 'S' THEN 's' ELSE defaclobjtype END::\"char\"",
                        dopt->binary_upgrade);

        appendPQExpBuffer(query, "SELECT d.oid, d.tableoid, "
                          "(%s d.defaclrole) AS defaclrole, "
                          "d.defaclnamespace, "
                          "d.defaclobjtype, "
                          "%s AS defaclacl, "
                          "%s AS rdefaclacl, "
                          "%s AS initdefaclacl, "
                          "%s AS initrdefaclacl "
                          "FROM pg_default_acl d "
                          "LEFT JOIN pg_init_privs pip ON "
                          "(d.oid = pip.objoid "
                          "AND pip.classoid = 'pg_default_acl'::regclass "
                          "AND pip.objsubid = 0) ",
                          username_subquery,
                          acl_subquery->data,
                          racl_subquery->data,
                          initacl_subquery->data,
                          initracl_subquery->data);
    }
......

Here is a patch.

Best Regards!




Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: WAL usage calculation patch
Next
From: Tomas Vondra
Date:
Subject: Re: [PATCH] Incremental sort (was: PoC: Partial sort)