From: | Ted Yu <yuzhihong(at)gmail(dot)com> |
---|---|
To: | akapila(at)postgresql(dot)org, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | properly sizing attnums in pg_get_publication_tables |
Date: | 2023-01-13 15:37:29 |
Message-ID: | CALte62watWE6moG8XbRWDU17wbG+hwE0adxp2tqP6OGLcRn6gg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I was looking at commit b7ae03953690a1dee455ba3823cc8f71a72cbe1d .
In `pg_get_publication_tables`, attnums is allocated with size
`desc->natts`. However, since some columns may be dropped, this size may be
larger than necessary.
When `nattnums > 0` is false, there is no need to allocate the `attnums`
array. In the current formation, `attnums` should be freed in this scenario.
Please take a look at the patch which moves the allocation to inside the
`if (nattnums > 0)` block.
Thanks
Attachment | Content-Type | Size |
---|---|---|
proper-sizing-of-attnums.patch | application/octet-stream | 1.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Nikolay Samokhvalov | 2023-01-13 16:03:00 | Re: Transaction timeout |
Previous Message | Zhang Mingli | 2023-01-13 15:09:30 | Re: Fix condition in shm_toc and remove unused function shm_toc_freespace. |