public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chris Hanks <[email protected]>
To: [email protected]
Subject: Function not found while creating partial index
Date: Sun, 1 Feb 2026 13:56:47 -0500
Message-ID: <CAK7KUdB48U+Q2MTV1+M+0sXe2sqMhfWF=EAcFtZDFsOyunPzsA@mail.gmail.com> (raw)

Hello! The following series of statements results in an unexpected (to me)
error on 18.0 and 18.1:

CREATE FUNCTION my_function_1(n integer) RETURNS integer AS 'SELECT n'
LANGUAGE SQL IMMUTABLE;
CREATE FUNCTION my_function_2(n integer) RETURNS integer AS 'SELECT
my_function_1(n)' LANGUAGE SQL IMMUTABLE;
CREATE SCHEMA my_schema;
CREATE TABLE my_schema.my_table (my_number integer);
CREATE INDEX my_index ON my_schema.my_table (my_number) WHERE
my_function_2(my_number) = 4;

The CREATE INDEX fails with the following error:

ERROR:  function my_function_1(integer) does not exist
LINE 1: SELECT my_function_1(n)
               ^
HINT:  No function matches the given name and argument types. You might
need to add explicit type casts.
QUERY:  SELECT my_function_1(n)
CONTEXT:  SQL function "my_function_2" during inlining

SQL state: 42883

If I change the definition of my_function_2 to 'SELECT
public.my_function_1(n)' then the index builds successfully, so that's my
current workaround.

Thank you!


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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Function not found while creating partial index
  In-Reply-To: <CAK7KUdB48U+Q2MTV1+M+0sXe2sqMhfWF=EAcFtZDFsOyunPzsA@mail.gmail.com>

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

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