pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Philip Semanchuk <philip@americanefficient.com>
To: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Could Postgres warn about incorrect volatility class?
Date: Thu, 28 Apr 2022 13:11:28 -0400
Message-ID: <5EB0EA00-DDFC-466C-88EE-F2230065EC24@americanefficient.com> (raw)

Hi all,
I recently discovered that a custom function that I thought was being inlined was not being inlined because I had declared it IMMUTABLE, but the function body cast an enum value to text which is a STABLE operator. Once I corrected my function's definition to declare it STABLE, Postgres inlined it. 

Since Postgres can apparently determine during query parsing that my function has a volatility class mismatch, is there a reason that Postgres can't make the same determination and inform me about it when I define the function? In this case a helpful message would have been "I sure hope you know what you're doing..." :-)

Thanks 
Philip




Message-ID: <5EB0EA00-DDFC-466C-88EE-F2230065EC24@americanefficient.com>
Permalink:  ../5EB0EA00-DDFC-466C-88EE-F2230065EC24@americanefficient.com/
Also on:    postgresql.org/message-id/5EB0EA00-DDFC-466C-88EE-F2230065EC24@americanefficient.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: philip@americanefficient.com
  Subject: Re: Could Postgres warn about incorrect volatility class?
  In-Reply-To: <5EB0EA00-DDFC-466C-88EE-F2230065EC24@americanefficient.com>
  References: <5EB0EA00-DDFC-466C-88EE-F2230065EC24@americanefficient.com>

* 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