| From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
|---|---|
| To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
| Cc: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, Petr Jelinek <petr(at)2ndquadrant(dot)com> |
| Subject: | Re: TransactionIdGetCommitTsData and its dereferenced pointers |
| Date: | 2015-08-21 17:42:23 |
| Message-ID: | 20150821174221.GZ5232@alvherre.pgsql |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Michael Paquier wrote:
> TransactionIdGetCommitTsData(at)commit_ts(dot)c does the following:
> if (ts)
> *ts = entry.time;
> [...]
> return *ts != 0;
> This is a bad idea, because if TransactionIdGetCommitTsData is called
> with ts == NULL this would simply crash. It seems to me that it makes
> little sense to have ts == NULL either way because this function is
> intended to return a timestamp in any case, hence I think that we
> should simply Assert(ts == NULL) and remove those checks.
I pushed this. But without the assert, because it's pointless: if the
passed pointer were indeed null, we would still crash later in the
function, getting the same effect as the assert.
Thanks,
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2015-08-21 17:42:53 | Re: Warnings around booleans |
| Previous Message | Stephen Frost | 2015-08-21 17:39:19 | Re: Warnings around booleans |