NikolayS / postgres_dba

The missing set of useful tools for Postgres DBAs and all engineers
BSD 3-Clause "New" or "Revised" License
1.03k stars 113 forks source link

e1: highlight outdated extension versions (fix logic) #33

Closed NikolayS closed 5 years ago

NikolayS commented 5 years ago

It is incorrect to compare pg_available_extensions.installed_version to pg_extension.extversion, it should be compared to pg_available_extensions.default_version. It led to incorrectly working actuality flag – at all times it was empty.

This commit fixes it. Also, available_extension column is removed – its logic was wrong from the very beginning.

Example:

Nastradamus commented 5 years ago

Neat. Do we need to fill actuality with something if everything is ok? E.g., following example looks slightly empty:

  name   | installed_version | default_version | actuality
---------+-------------------+-----------------+-----------
 plpgsql | 1.0               | 1.0             |
 plsh    | 2                 | 2               |
(2 rows)
NikolayS commented 5 years ago

@Nastradamus I've renamed the column to is_old

Nastradamus commented 5 years ago

@NikolayS should we use true or false as a required value for this column (id_old)?

NikolayS commented 5 years ago

@Nastradamus here we come to the question, what is better for humans and what is better for "robots". The current way how it's implemented -- it's better for humans. If "it is not old", we don't see anything in the column (if NULLs representation is not tuned in psql), and easily catch "OLD" rows.

For robots, it would be more appropriate to have true/false, yes.