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.98.2) (envelope-from ) id 1xJmBR-00000000QYH-21CT for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Oct 2026 06:21:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xJmBO-00000009A7J-37Rz for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Oct 2026 06:21:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xJ5w9-0000000BMVR-2Qzv for pgsql-bugs@lists.postgresql.org; Tue, 20 Oct 2026 09:15:13 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xJ5w5-00000002wQb-2Yd8 for pgsql-bugs@lists.postgresql.org; Tue, 20 Oct 2026 09:15:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=YbIRROEjVM5BnfhtLKRhHob+N0mxby8anwb97RbXe7Q=; b=2Mmz/W8NmCrsBm+Uwu/VMeYcyE kOwk0s+6uCPb6toGm3VXwSn7GNiBz8O94+T8KXtj7gKl+TV03U/eMlYs8pBRi1IGu3E7daoc83ajn 2S8juP+y4ul8HeFrKHF9JM6BcaBFtPwydpR844S3SLKSgh/g3fzpqyVaMZwYZwvondHS08PUqRQWw uOUQ2k1k2lC+ji23bNJIacdfbmXyb7iyaJfGHTJWXR+Fw9QbiQk1dTidSf8sxq84Dq3aP4wRgyb4r 410xkxrTQhTXJauX+b7lJe4YP/ytZ123FX38id9LMgh4MQqJ0bc7d9eLhQ9cs8jDrCM0+nkA0t7zk DRimlDAQ==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xJ5w2-00000008YGS-1DH6 for pgsql-bugs@lists.postgresql.org; Tue, 20 Oct 2026 09:15:07 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xJ5w0-000000082rV-4Bi8 for pgsql-bugs@lists.postgresql.org; Tue, 20 Oct 2026 09:15:05 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19777: PERIOD foreign key rejects an empty referencing range even though the referenced period covers it To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: 1482694023@qq.com Reply-To: 1482694023@qq.com, pgsql-bugs@lists.postgresql.org Date: Tue, 20 Oct 2026 09:14:48 +0000 Message-ID: <19777-e1090cf88c970b8b@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19777 Logged by: N J Email address: 1482694023@qq.com PostgreSQL version: 18.6 Operating system: Windows 11 x64 Description: =20 Tested with PostgreSQL 18.6 on Windows 11 x64. No extensions or non-default configuration are required. On a fresh connection, run the setup and check: CREATE TEMP TABLE period_parent_minimal ( k int4range NOT NULL, p int4range NOT NULL, PRIMARY KEY (k, p WITHOUT OVERLAPS) ); INSERT INTO period_parent_minimal VALUES ('[1,2)'::int4range, '[0,10)'::int4range); CREATE TEMP TABLE period_child_minimal ( k int4range NOT NULL, p int4range NOT NULL, FOREIGN KEY (k, PERIOD p) REFERENCES period_parent_minimal (k, PERIOD p) ); SELECT range_agg(p) @> 'empty'::int4range AS parent_covers_empty FROM period_parent_minimal WHERE k =3D '[1,2)'::int4range; The SELECT returns true. Then run: INSERT INTO period_child_minimal VALUES ('[1,2)'::int4range, 'empty'::int4range); Actual result: rejected with SQLSTATE 23503 (foreign key violation). Expected result: the insert should succeed if an empty referencing period is considered covered by the referenced period, consistent with range containment and the documented PERIOD foreign-key coverage rule. Please confirm whether empty referencing periods are intended to satisfy PERIOD foreign keys.