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 1x4fWA-007JBl-0q for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Sep 2026 14:12:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x4fW9-006Qe6-0k for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Sep 2026 14:12:45 +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 1x4fW8-006Qdy-2n for pgsql-bugs@lists.postgresql.org; Thu, 10 Sep 2026 14:12:44 +0000 Received: from lahtoruutu.iki.fi ([185.185.170.37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x4fW6-00000003yLK-2VIb for pgsql-bugs@lists.postgresql.org; Thu, 10 Sep 2026 14:12:44 +0000 Received: from [10.0.2.15] (unknown [75.125.238.33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4hgfl90nZtz49Py8 for ; Thu, 10 Sep 2026 17:12:36 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1789049557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Nzz8zW5MYLO9LLi+zNNLW3HfW+ePOiRPaozadkrJdSw=; b=b/6zWOxrp/rm7CFXwtY7cT1kAyKq8X9qp4UHzgFkH2XhPE97hpP3XmnnogDIHUH/9j6XJK JfxiPUmD6X7jjyvdzawa4f7Nno26sceTKRNg3hruH8qkVNqyO32Appm0lxAcR2zFgTlBzy C2Mzo7CKwiOPSnzvKJjXmjzPm7lMOB54Tmdax90SJs8mVF7A27MaZ3qcLfPFkcVIsdLwto Xf4ShACV+yGRiYJ/axFAJEPLPV2ksNSV2I2b+W9QWGS8XIi1wrST8dxSRMVtWH1FA/L1HC 724t+rvXdLM9e0i5i27ivvgszpY4udstcnuew1Ky81BiWAbo0XCvQbcLBCjXXw== ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1789049557; b=MKNuOT1DrBRGPaPLW3UlNZv9ysK+ToEUkbo0+MY2ac3hfrXQtYAeY2jBOf/MycdT2IyS4e lBumjDpRfM7du9aZJoMZv18jjg7sfKJU8Z3MrerXQ6RSsE53zmfkSyBFPytxwOFLy2saml OdcPHeOf0gfzioQLfPtl2JYxz9KsB0wYqdvjlyA8HAgwyMJWkBGWxfaHvlkdKO8Izjy+nn Mmzxud69JWa+lr76bj7X3/rFYMtJ9Xpc0+DGK8TNb9eHx83sPpPCcN+ieHfOhDS+arm0MI 2ya5jD9NF5K0oFXkYwl8L9mXK7lmT+BdhAScMe2FmRhgoxGdj9OfqcRa1f2RXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1789049557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Nzz8zW5MYLO9LLi+zNNLW3HfW+ePOiRPaozadkrJdSw=; b=ATjfVTUA3pl2+uq+419YfuySzKrv9dT6RB9XYvXgUhfl+BToiEGwuctdCpJmrishHXmUTU Mlbtz/GuV7ULWxKLaTQE2USQE+yql+ljM+uUczFcTA8d40BynWNwKJQ1POHlmNv72NU6BU piDLfyQojYA7UlkU+Inz3YPTr1natmT9GENH5eaUxXoazbIruwN8Zj/jAheVW1YJVNg3oF fshI+obfsvFKefAIpAaYC9LheN/AazOJKcN1Np2rwIBZMlIuAPaMRo4ARdsS6zazZCmaFG V1Yl9Ok2D0S4lF6wetMj8bdY/3jrqaxnT76TOTrcIBm2JKX5ag74EljFfqiktg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: Date: Thu, 10 Sep 2026 17:12:31 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Heikki Linnakangas Subject: Detaching a child table makes an expression using it unrestorable To: "pgsql-bugs@lists.postgresql.org" Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I bumped into a sequence of commands that breaks pg_dump & restore: ------------ create table at_tab (a int, b int); create table at_tab_child (a int, b int); alter table at_tab_child inherit at_tab; -- You can use the child's rowtype in the DEFAULT without a cast. CREATE FUNCTION func_with_default( arg at_tab DEFAULT ('(1, 2)'::at_tab_child) ) RETURNS integer LANGUAGE plpgsql as $$ begin return arg.b; end; $$; -- We allow detaching the child from the parent, despite the DEFAULT -- expression. That is a not good, because if you try to recreate the -- function, it's not accepted. I.e. pg_dump & restore is broken alter table at_tab_child no inherit at_tab; ------------ The function still works after that. But if you run pg_dump (or do \ef or something), the CREATE FUNCTION is deparsed as above, and when you try to restore it you get an error: ERROR: argument of DEFAULT must be type at_tab, not type at_tab_child LINE 1: ...CTION public.func_with_default(arg at_tab DEFAULT '(1,2)'::a... You get the same effect with ATTACH/DETACH PARTITION instead of INHERIT/NO INHERIT. - Heikki