Re: Pgstattuple on Sequences: Seeking Community Feedback on Potential Patch
Ayush Vatsa <ayushvatsa1810@gmail.com>
From: Ayush Vatsa <ayushvatsa1810@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, michael@paquier.xyz
Date: 2024-08-26T18:09:35Z
Lists: pgsql-hackers
> You state that the > information pgstattuple provides isn't really useful for sequences, so > that means there's no real reason to do (1) That's correct, but we should consider that up until v11, sequences were supported in pgstattuple. Their support was removed unintentionally (I believe so). Therefore, it might be worth discussing whether it makes sense to reinstate support for sequences. > why you think that the current one is bad The current implementation has some drawbacks. For instance, when encountering other unsupported objects, the error looks like this: ERROR: cannot get tuple-level statistics for relation "x" DETAIL: This operation is not supported for foreign tables. However, for sequences, the message should explicitly state that "This operation is not supported for sequences." Currently, we're deducing that the heap access method (AM) is for relkind='r', so the message "only heap AM is supported" implies that only relkind='r' are supported. This prompted my thoughts on the matter. Moreover, if you refer to the code in pgstattuple.c <https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L255-L256> , you'll notice that sequences appear to be explicitly allowed in pgstattuple, but it results in an error encountered here - https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L326-L329 Therefore, I believe a small refactoring is needed to make the code cleaner and more consistent. > IMHO it would be good to establish some level of consistency here. Agree. Let me know your thoughts. Regards Ayush Vatsa AWS
Commits
-
Fix contrib/pageinspect's test for sequences.
- ef46a73f6941 13.17 landed
- e0277d90acf6 12.21 landed
- a63aef5e496c 15.9 landed
- 9b3c3c0fc206 17.0 landed
- 70d1c664f437 18.0 landed
- 0970889e352c 14.14 landed
- 0938a4ecda33 16.5 landed
-
Reintroduce support for sequences in pgstattuple and pageinspect.
- e03042a7003d 15.9 landed
- dd5670fa549e 12.21 landed
- ca902529cc0f 13.17 landed
- 8a94af8a2d0f 14.14 landed
- 6ea7f04b7366 17.0 landed
- 2bd4c06bba8c 16.5 landed
- 05036a3155c1 18.0 landed
-
Only allow heap in a number of contrib modules.
- 4b82664156c2 12.0 cited