pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Euler Taveira <euler@eulerto.com>
Cc: Tender Wang <tndrwang@gmail.com>
Cc: tharakan@gmail.com, pgsql-bugs@lists.postgresql.org, "Heikki Linnakangas" <hlinnaka@iki.fi>
Subject: Re: BUG #18866: Running pg_freespace() on views triggers an Abort
Date: Wed, 26 Mar 2025 12:00:59 -0400
Message-ID: <1618267.1743004859@sss.pgh.pa.us> (raw)
In-Reply-To: <b6ea023a-703d-4afa-8561-9e867db1b5f0@app.fastmail.com>
References: <18866-d68926d0f1c72d44@postgresql.org>
	<CAHewXNk6uX0VBROmoMrnKs_AOzbAQo+i9pouUiYj01y50HZRSw@mail.gmail.com>
	<1280897.1742920635@sss.pgh.pa.us>
	<CAHewXNm8rkn9Vu-WhmMQMJS2hSqztbJO1cRv5-+Rp99+k43aJw@mail.gmail.com>
	<b6ea023a-703d-4afa-8561-9e867db1b5f0@app.fastmail.com>

"Euler Taveira" <euler@eulerto.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.  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.

			regards, tom lane





view thread (14+ messages)  latest in thread

Message-ID: <1618267.1743004859@sss.pgh.pa.us>
Permalink:  ../1618267.1743004859@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1618267.1743004859@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, euler@eulerto.com, tndrwang@gmail.com, hlinnaka@iki.fi
  Subject: Re: BUG #18866: Running pg_freespace() on views triggers an Abort
  In-Reply-To: <1618267.1743004859@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox