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.94.2) (envelope-from ) id 1snv3j-006wiM-KW for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Sep 2024 07:13:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1snv3j-008Inm-4H for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Sep 2024 07:13:07 +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.94.2) (envelope-from ) id 1snv3i-008Ine-RP for pgsql-bugs@lists.postgresql.org; Tue, 10 Sep 2024 07:13:06 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snv3b-000Qvg-No for pgsql-bugs@postgresql.org; Tue, 10 Sep 2024 07:13:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description; bh=SqlJMm3wRv8/DeVxTE0D018Tz5aDYTczgoj6zLi8De4=; b=O1cCI3GRjupiRnivpAXfCDlF/Q lrpVeYZtff0OKJ3JfacACn7+VhzCLeajnh5feBNL/bbK3/rLD6DycQGwg2j2sr8efdMZHsA2v2Gi1 xk1Vcum0khtVRqHlzY+66J1k3z3TiRqymNnk57YXnzVcsjQPwipNQKwGriniuwkvl0fY=; Received: from depesz by depesz.com with local (Exim 4.96) (envelope-from ) id 1snv3c-008CkD-0m; Tue, 10 Sep 2024 09:13:00 +0200 Date: Tue, 10 Sep 2024 09:13:00 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Sanskar Agrawal Cc: pgsql-bugs mailing list Subject: Re: BUG #18607: UNION ALL discards all foreign key relations + indexes Message-ID: Reply-To: depesz@depesz.com References: <18607-651aa996c1e71d48@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Sep 10, 2024 at 12:41:14PM +0530, Sanskar Agrawal wrote: > Yes consider a small table as users with users.id as primary key, > > took two rows from the same and ran a union all it tends to drop the > indexes + foreign relations Please show full example that I can run on empty DB. Set of create table statement(s), adding indexes, foreign keys, and then create view, that results in dropped indexes/foreign keys. Best regards, depesz