Incorrect comment in postgres_fdw.c

Started by Etsuro Fujitaover 11 years ago4 messages
#1Etsuro Fujita
fujita.etsuro@lab.ntt.co.jp
1 attachment(s)

I think the following comment for store_returning_result() in
postgres_fdw.c is not right.

/* PGresult must be released before leaving this function. */

I think PGresult should not be released before leaving this function *on
success* in that function.

(I guess the comment has been copied and pasted from that for
get_remote_estimate().)

Thanks,

Best regards,
Etsuro Fujita

Attachments:

postgres_fdw-comment.patchtext/x-diff; name=postgres_fdw-comment.patchDownload
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 7dd43a9..f328833 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -2257,7 +2257,6 @@ static void
 store_returning_result(PgFdwModifyState *fmstate,
 					   TupleTableSlot *slot, PGresult *res)
 {
-	/* PGresult must be released before leaving this function. */
 	PG_TRY();
 	{
 		HeapTuple	newtup;
#2Shigeru Hanada
shigeru.hanada@gmail.com
In reply to: Etsuro Fujita (#1)
Re: Incorrect comment in postgres_fdw.c

Fujita-san,

2014-07-11 18:22 GMT+09:00 Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>:

I think the following comment for store_returning_result() in
postgres_fdw.c is not right.

/* PGresult must be released before leaving this function. */

I think PGresult should not be released before leaving this function *on
success* in that function.

(I guess the comment has been copied and pasted from that for
get_remote_estimate().)

+1 for just removing the comment, because header comment clearly
mentions necessity of releasing the PGresult.

--
Shigeru HANADA

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Fujii Masao
masao.fujii@gmail.com
In reply to: Shigeru Hanada (#2)
Re: Incorrect comment in postgres_fdw.c

On Mon, Jul 14, 2014 at 7:31 PM, Shigeru Hanada
<shigeru.hanada@gmail.com> wrote:

Fujita-san,

2014-07-11 18:22 GMT+09:00 Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>:

I think the following comment for store_returning_result() in
postgres_fdw.c is not right.

/* PGresult must be released before leaving this function. */

I think PGresult should not be released before leaving this function *on
success* in that function.

(I guess the comment has been copied and pasted from that for
get_remote_estimate().)

+1 for just removing the comment, because header comment clearly
mentions necessity of releasing the PGresult.

Committed. Thanks for the report!

Regards,

--
Fujii Masao

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Etsuro Fujita
fujita.etsuro@lab.ntt.co.jp
In reply to: Fujii Masao (#3)
Re: Incorrect comment in postgres_fdw.c

(2014/07/14 19:46), Fujii Masao wrote:

On Mon, Jul 14, 2014 at 7:31 PM, Shigeru Hanada
<shigeru.hanada@gmail.com> wrote:

Fujita-san,

2014-07-11 18:22 GMT+09:00 Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>:

I think the following comment for store_returning_result() in
postgres_fdw.c is not right.

/* PGresult must be released before leaving this function. */

I think PGresult should not be released before leaving this function *on
success* in that function.

(I guess the comment has been copied and pasted from that for
get_remote_estimate().)

+1 for just removing the comment, because header comment clearly
mentions necessity of releasing the PGresult.

Committed. Thanks for the report!

Thank you for committing the patch! And thanks, Hanada-san!

Best regards,
Etsuro Fujita

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers