Re: BUG #18866: Running pg_freespace() on views triggers an Abort

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Euler Taveira <euler(at)eulerto(dot)com>, tharakan(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: BUG #18866: Running pg_freespace() on views triggers an Abort
Date: 2025-03-27 07:14:19
Message-ID: CAHewXNkND-jyFhxShh8Zf6ZNZ41V6skiAp_nwNrOBX25Gd02ig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 于2025年3月27日周四 00:01写道:

> "Euler Taveira" <euler(at)eulerto(dot)com> writes:
> > Your patch needs some adjustments. There is no need to include
> pg_class.h. I
> > don't like the proposed error message. I prefer saying the relation
> cannot be
> > opened because that's what will happen if it reaches this code path.
>
> I don't care for that proposal either: we just did open the relation ;-)
>
> Looking at other places where we throw an error for !RELKIND_HAS_STORAGE:
>
> rawpage.c:
> (errcode(ERRCODE_WRONG_OBJECT_TYPE),
> errmsg("cannot get raw page from relation \"%s\"",
>
> pgstatindex.c:
>
> (errcode(ERRCODE_WRONG_OBJECT_TYPE),
> errmsg("cannot get page count of relation \"%s\"",
>
> tid.c:
> errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> errmsg("cannot look at latest visible tid for relation
> \"%s.%s\"",
>
> relcache.c:
> elog(ERROR, "relation \"%s\" does not have storage",
> RelationGetRelationName(relation));
>
> So the previous proposal was evidently modeled on the first two of
> these precedents.

Yes, I referred to the rawpage.c.

> Personally I prefer messages that say *why*
> something failed, so I'd go with something more like "relation \"%s\"
> does not have storage". Use of errdetail_relkind_not_supported is
> fine though.
>

PFA for the updated patch file.

--
Thanks,
Tender Wang

Attachment Content-Type Size
v3-0001-Don-t-allow-no-storage-relation-to-get-FSM-info.patch text/plain 1.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Guo 2025-03-27 08:48:22 Re: BUG #18866: Running pg_freespace() on views triggers an Abort
Previous Message Alvaro Herrera 2025-03-26 19:06:08 Re: BUG #18866: Running pg_freespace() on views triggers an Abort