table_delete and table_update don't document snapshot parameter

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: table_delete and table_update don't document snapshot parameter
Date: 2019-05-17 15:34:25
Message-ID: CA+Tgmoa1hKT04kZTSD9+QgKpnf1vvuYNRYt7qUj242bk24z+jQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

table_update and table_delete both have comments that document all of
their input parameters *except* for snapshot. This seems like an
oversight, especially because:

* crosscheck - if not InvalidSnapshot, also check tuple against this

Without a comment about snapshot, what's the "also" about?

Suspiciously, the heap implementations of these functions completely
ignore the snapshot parameter and have no comments explaining the
reasons why they do so. In fact, the only comment in
heapam_tuple_delete is this one, and it seems both misplaced (since it
seems to be a general comment about table AMs, not something
heap-specific) and in need of editing:

/*
* Currently Deleting of index tuples are handled at vacuum, in case if
* the storage itself is cleaning the dead tuples by itself, it is the
* time to call the index tuple deletion also.
*/

One particular thing I'm curious whether it's ever OK to pass the
snapshot as InvalidSnapshot, or whether it's expected a valid snapshot
should always be supplied. If the latter, I think it would be a good
idea to add an Assert() to table_update and table_delete() to avoid
coding mistakes.

Thanks,

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2019-05-17 15:35:01 Re: jsonpath
Previous Message Tom Lane 2019-05-17 14:48:03 Re: Emacs vs pg_indent's weird indentation for function declarations