Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vmsxI-00HNNn-1H for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Feb 2026 12:23:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vmsxG-00DmRi-1W for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Feb 2026 12:22:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vmsxG-00DmRZ-0X for pgsql-bugs@lists.postgresql.org; Mon, 02 Feb 2026 12:22:59 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vmsxE-00000000fo0-1CoU for pgsql-bugs@lists.postgresql.org; Mon, 02 Feb 2026 12:22:58 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-47ee76e8656so58244475e9.0 for ; Mon, 02 Feb 2026 04:22:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1770034974; x=1770639774; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=eIKbuJzyKO/2VhiwUufD88d+DgBs7UGCzbWJUHwRGP0=; b=Lwf/zDM+vCgnlJfbg72BsBoiF3mehrK8i6ym4EDn8YZ18h9xCr8EFryz0uxQWxz7sN t0WaIo/tDePzhP2pPZptAQ/yCpq/Bwqxq/57riF1+kEyjPH3egxsZtFp5O9Xbg6udLMb E2uX6JFG5zR66PwXmem8U7zBeHnXRAc/uU9Oj+Md0XiiybfGYeliByYnq0Ilx9iE4XIf 4AdszxyZrvgfg31L4VIF+vZDvyi+dp5sk39zfGuxjnNZtyHz34wVZ0vbv3NdAmKBb3TO 9bXOCX0ohmu7JtZ7FSW43FOLR6W8MDC5ffw4W4bACcuvHc2kzduWiX17DHl7TxshIr2J 4nbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770034974; x=1770639774; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eIKbuJzyKO/2VhiwUufD88d+DgBs7UGCzbWJUHwRGP0=; b=uLW9WmAcKVZIjcukEdnBjHmahVMk7LPc5FLBn9dbzd94y+pj9KlXwE6KzMKYbVOpsv X2WxTAFG31ixQtGfCNnykwIqzwQn2ErSWJT/SHIjTFhYRcGhgIOuMvk2FkwIG/PjOOnB /Jpeo6ub5OPlCVuudX1GLAIEEpSyrnMImpmkrCmh1LVsbUKfM8rGivc4ELV/uAHhavVn QWVs5hzs7czKgvMs67erLODYpkjeRG2e9+tzP8xMYmverCWHYEUjsf1B1jDwK9a4W4hS loQtcltRAeeoRjAsWwk9bq/VPUVdTygG6fQQVysQxwbrvZbmCgN+jo/WczM0sP9mQf4t 1UDw== X-Forwarded-Encrypted: i=1; AJvYcCWoDD+0usEf5RqH0KndZuYXJUCot3cQCZUJVlPwln84z9atucP4fsGazITjzNNz/8sgtHUTqXGI4+DG@lists.postgresql.org X-Gm-Message-State: AOJu0YyKEc9XixGYu5yW2iRMiPL19yyFbs9s89mXkm0DovWgtlSWae6f ZPreMjVhy/VUbwJ3e0Kqd8udf452Sa1sknJKJH10cQpq0DHEZKttMTelo0nHkIr/QlcKtDhSVHX jk64z X-Gm-Gg: AZuq6aJ1J4xVab4Finr5P3+1RsFaaav92lhk8WUf7GvrH+WxfkNCBNgeaUfQFC+CoiC LVRZrpMKH/86QiBs1VAVNyEa5RG806z6bI2OETbv520FYeNrbAOC8Xn9Ep79pjyT/pJTfbKinXI oKHe6gR/hFGUDOfgJLs4JU5sYwrUf/nCVHOw98mqohd4wQj4v9KeKR0x/I0bBr+1W3S3orKXuD9 S1SAJUfonmkOucp/CZF8aJruuuy+MCl3pRUPxlcQt5ZHXwAYCBI5fe6CQM/ZWnCsW1gphnofYoF blYJUIPcQ5jLjRTSnm0bcytb8ZZ1R3eCcZQJpudZsegjErj/nfeo5CuwrIo4r964rdXyg3yfQ4W YLZFsROvl1KyOQTaUQW3sgWOJjWfL3kNmOKNFnUG4drOqUU7v4rmYQdlU+GzSWrpmlbwztJrRNS uVkUcOdHP/QdkD4PPCRvGhCLnDX1bxSycdseYnLA== X-Received: by 2002:a05:600c:530f:b0:480:4a90:1afe with SMTP id 5b1f17b1804b1-482db4a62aamr146322505e9.34.1770034974033; Mon, 02 Feb 2026 04:22:54 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:70:d7:4e4a:1725:1dd5:93e5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48066c428basm482212275e9.12.2026.02.02.04.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 04:22:53 -0800 (PST) Message-ID: <10b34e0a0963e01bec1a34200eadc0f024f598cd.camel@cybertec.at> Subject: Re: Function not found while creating partial index From: Laurenz Albe To: Chris Hanks , pgsql-bugs@lists.postgresql.org Date: Mon, 02 Feb 2026 13:22:53 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.2 (3.58.2-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, 2026-02-01 at 13:56 -0500, Chris Hanks wrote: > Hello! The following series of statements results in an unexpected (to me= ) error on 18.0 and 18.1: >=20 > CREATE FUNCTION my_function_1(n integer) RETURNS integer AS 'SELECT n' LA= NGUAGE SQL IMMUTABLE; > CREATE FUNCTION my_function_2(n integer) RETURNS integer AS 'SELECT my_fu= nction_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) =3D 4; >=20 > The CREATE INDEX fails with the following error: >=20 > ERROR: =C2=A0function my_function_1(integer) does not exist > LINE 1: SELECT my_function_1(n) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^ > HINT: =C2=A0No function matches the given name and argument types. You mi= ght need to add explicit type casts. > QUERY: =C2=A0SELECT my_function_1(n) > CONTEXT: =C2=A0SQL function "my_function_2" during inlining=20 >=20 > SQL state: 42883 >=20 > 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. That's not the workaround, that's the proper solution. See the documentation (https://www.postgresql.org/docs/current/sql-createin= dex.html): > While CREATE INDEX is running, the search_path is temporarily changed to = pg_catalog, pg_temp. Yours, Laurenz Albe