Re: remove pg_class.relhaspkey

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: remove pg_class.relhaspkey
Date: 2018-02-26 05:36:13
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

On Sat, Feb 24, 2018 at 10:21:44PM -0500, Tom Lane wrote:
> Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
> > pg_class.relhaspkey doesn't seem to be used or useful for anything, so
> > can we remove it? See attached patch.
> We've discussed that at least twice before, and not pulled the trigger
> for fear of breaking client code.
> Not sure that the situation has changed any since then ... it still
> comes down to whether we want an API break for client code.

I would be of the opinion to drop them. Even if some client code rely
on this information, it means that they also rely on some information
which may be incorrect if those are not updated when they should be for
certain DDL combinations. And in my opinion that's bad. It seems to me
that if we would want to do some cleanup, this should happen for all the
flags that are updated in a lazy fashion. For most of them, it would be
easy enough to replace them by subqueries which scan other catalog
information for correct and actually up-to-date information. So in this
category enter as well relhassubclass, relhastriggers and relhasrules.

Speaking of which, I have looked at where relhaspkey is being used. And
there are a couple of things using it:
- Greenplum has a consistency checker tool using it.
So the answer is yes, there would be code breakages if those get
removed. Still I would imagine that such applications ought to use
subquery patterns and not rely on the existing flags, as this causes in
the worst case extra round trips between the server and the client as
the client is unsure if the information is up-to-date or not.

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-02-26 05:37:15 Re: [HACKERS] SERIALIZABLE with parallel query
Previous Message Amit Langote 2018-02-26 04:15:28 Re: [HACKERS] Runtime Partition Pruning