public inbox for [email protected]
help / color / mirror / Atom feedIssue with pgstattuple on Sequences in PostgreSQL
6+ messages / 6 participants
[nested] [flat]
* Issue with pgstattuple on Sequences in PostgreSQL
@ 2024-06-24 11:09 Ayush Vatsa <[email protected]>
2024-06-24 11:38 ` Re: Issue with pgstattuple on Sequences in PostgreSQL Kashif Zeeshan <[email protected]>
2024-06-24 12:56 ` Re: Issue with pgstattuple on Sequences in PostgreSQL Ron Johnson <[email protected]>
2024-06-24 13:35 ` Re: Issue with pgstattuple on Sequences in PostgreSQL David G. Johnston <[email protected]>
2024-06-24 14:32 ` Re: Issue with pgstattuple on Sequences in PostgreSQL Adrian Klaver <[email protected]>
2024-06-25 00:37 ` Re: Issue with pgstattuple on Sequences in PostgreSQL Tatsuo Ishii <[email protected]>
0 siblings, 5 replies; 6+ messages in thread
From: Ayush Vatsa @ 2024-06-24 11:09 UTC (permalink / raw)
To: [email protected]
Hi PostgreSQL Community,
I was recently exploring the pgstattuple code directory and found this
piece of code:
https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L255-L259
.
It indicates that pgstattuple supports relations, toast tables,
materialized views, and sequences.
However, when I executed a query with a sequence, I encountered the
following error:
postgres=> CREATE SEQUENCE serial START 101;
CREATE SEQUENCE
postgres=> SELECT * FROM pgstattuple('serial');
ERROR: only heap AM is supported
postgres=>
It got stuck in this if condition -
https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L326-L329
How can one use pgstattuple on sequences?
Regards,
Ayush Vatsa
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Issue with pgstattuple on Sequences in PostgreSQL
2024-06-24 11:09 Issue with pgstattuple on Sequences in PostgreSQL Ayush Vatsa <[email protected]>
@ 2024-06-24 11:38 ` Kashif Zeeshan <[email protected]>
4 siblings, 0 replies; 6+ messages in thread
From: Kashif Zeeshan @ 2024-06-24 11:38 UTC (permalink / raw)
To: Ayush Vatsa <[email protected]>; +Cc: [email protected]
Hi
I dont think Sequences are support, please refer to the following
documentation.
https://www.postgresql.org/docs/current/pgstattuple.html
Regards
Kashif Zeeshan
On Mon, Jun 24, 2024 at 4:09 PM Ayush Vatsa <[email protected]>
wrote:
> Hi PostgreSQL Community,
>
> I was recently exploring the pgstattuple code directory and found this
> piece of code:
> https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L255-L259
> .
>
> It indicates that pgstattuple supports relations, toast tables,
> materialized views, and sequences.
> However, when I executed a query with a sequence, I encountered the
> following error:
>
> postgres=> CREATE SEQUENCE serial START 101;
> CREATE SEQUENCE
> postgres=> SELECT * FROM pgstattuple('serial');
> ERROR: only heap AM is supported
> postgres=>
>
> It got stuck in this if condition -
> https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L326-L329
> How can one use pgstattuple on sequences?
>
> Regards,
> Ayush Vatsa
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Issue with pgstattuple on Sequences in PostgreSQL
2024-06-24 11:09 Issue with pgstattuple on Sequences in PostgreSQL Ayush Vatsa <[email protected]>
@ 2024-06-24 12:56 ` Ron Johnson <[email protected]>
4 siblings, 0 replies; 6+ messages in thread
From: Ron Johnson @ 2024-06-24 12:56 UTC (permalink / raw)
To: pgsql-general
On Mon, Jun 24, 2024 at 7:09 AM Ayush Vatsa <[email protected]>
wrote:
[snip]
> How can one use pgstattuple on sequences?
>
Out of curiosity... *why*?
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Issue with pgstattuple on Sequences in PostgreSQL
2024-06-24 11:09 Issue with pgstattuple on Sequences in PostgreSQL Ayush Vatsa <[email protected]>
@ 2024-06-24 13:35 ` David G. Johnston <[email protected]>
4 siblings, 0 replies; 6+ messages in thread
From: David G. Johnston @ 2024-06-24 13:35 UTC (permalink / raw)
To: Ayush Vatsa <[email protected]>; +Cc: [email protected] <[email protected]>
On Monday, June 24, 2024, Ayush Vatsa <[email protected]> wrote:
>
> I was recently exploring the pgstattuple code directory and found this
> piece of code: https://github.com/postgres/postgres/blob/master/contrib/
> pgstattuple/pgstattuple.c#L255-L259.
>
> It indicates that pgstattuple supports relations, toast tables,
> materialized views, and sequences.
> However, when I executed a query with a sequence, I encountered the
> following error:
>
> postgres=> CREATE SEQUENCE serial START 101;
> CREATE SEQUENCE
> postgres=> SELECT * FROM pgstattuple('serial');
> ERROR: only heap AM is supported
> postgres=>
>
> It got stuck in this if condition - https://github.com/postgres/
> postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L326-L329
>
>
> How can one use pgstattuple on sequences?
>
As-is? Doesn’t look like you can. I agree it’s a documentation bug that
this is the case with a brief explanation of why - sequences do not produce
dead tuples and do not behave like real tables aside from being able to be
selected from (i.e., no SQL update/delete command).
The code should produce an explicit error for that relkind as well.
David J.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Issue with pgstattuple on Sequences in PostgreSQL
2024-06-24 11:09 Issue with pgstattuple on Sequences in PostgreSQL Ayush Vatsa <[email protected]>
@ 2024-06-24 14:32 ` Adrian Klaver <[email protected]>
4 siblings, 0 replies; 6+ messages in thread
From: Adrian Klaver @ 2024-06-24 14:32 UTC (permalink / raw)
To: Ayush Vatsa <[email protected]>; [email protected]
On 6/24/24 04:09, Ayush Vatsa wrote:
> Hi PostgreSQL Community,
>
> I was recently exploring the pgstattuple code directory and found this
> piece of code:
> https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L255-L259 <https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L255-L259;.
>
> It indicates that pgstattuple supports relations, toast tables,
> materialized views, and sequences.
> However, when I executed a query with a sequence, I encountered the
> following error:
>
> postgres=> CREATE SEQUENCE serial START 101;
> CREATE SEQUENCE
> postgres=> SELECT * FROM pgstattuple('serial');
> ERROR: only heap AM is supported
> postgres=>
File a bug report here:
https://www.postgresql.org/account/login/?next=/account/submitbug/
>
> It got stuck in this if condition -
> https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L326-L329 <https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L326-L329;
> How can one use pgstattuple on sequences?
>
> Regards,
> Ayush Vatsa
>
--
Adrian Klaver
[email protected]
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Issue with pgstattuple on Sequences in PostgreSQL
2024-06-24 11:09 Issue with pgstattuple on Sequences in PostgreSQL Ayush Vatsa <[email protected]>
@ 2024-06-25 00:37 ` Tatsuo Ishii <[email protected]>
4 siblings, 0 replies; 6+ messages in thread
From: Tatsuo Ishii @ 2024-06-25 00:37 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]; [email protected]
> On Monday, June 24, 2024, Ayush Vatsa <[email protected]> wrote:
>>
>> I was recently exploring the pgstattuple code directory and found this
>> piece of code: https://github.com/postgres/postgres/blob/master/contrib/
>> pgstattuple/pgstattuple.c#L255-L259.
>>
>> It indicates that pgstattuple supports relations, toast tables,
>> materialized views, and sequences.
>> However, when I executed a query with a sequence, I encountered the
>> following error:
>>
>> postgres=> CREATE SEQUENCE serial START 101;
>> CREATE SEQUENCE
>> postgres=> SELECT * FROM pgstattuple('serial');
>> ERROR: only heap AM is supported
>> postgres=>
>>
>> It got stuck in this if condition - https://github.com/postgres/
>> postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L326-L329
>>
>>
>> How can one use pgstattuple on sequences?
>>
>
> As-is? Doesn’t look like you can.
It used to work until v11.
test=# SELECT * FROM pgstattuple('serial');
-[ RECORD 1 ]------+------
table_len | 8192
tuple_count | 1
tuple_len | 41
tuple_percent | 0.5
dead_tuple_count | 0
dead_tuple_len | 0
dead_tuple_percent | 0
free_space | 8104
free_percent | 98.93
It stopped working by this commit:
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=4b82664156c230b59607704506f5b0a32ef49...
because pgstat_heap() rejects other than heap AM. I think the v12
release note should have explicitly mentioned that sequences are not
supported by pgstattuple any more.
> I agree it’s a documentation bug that
> this is the case with a brief explanation of why - sequences do not produce
> dead tuples and do not behave like real tables aside from being able to be
> selected from (i.e., no SQL update/delete command).
>
> The code should produce an explicit error for that relkind as well.
If so, then the regression test should be fixed as well. Currently
there's no test case for sequences.
Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2024-06-25 00:37 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-06-24 11:09 Issue with pgstattuple on Sequences in PostgreSQL Ayush Vatsa <[email protected]>
2024-06-24 11:38 ` Kashif Zeeshan <[email protected]>
2024-06-24 12:56 ` Ron Johnson <[email protected]>
2024-06-24 13:35 ` David G. Johnston <[email protected]>
2024-06-24 14:32 ` Adrian Klaver <[email protected]>
2024-06-25 00:37 ` Tatsuo Ishii <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox