pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: sanskar@flintk12.com
Subject: BUG #18607: UNION ALL discards all foreign key relations + indexes
Date: Mon, 09 Sep 2024 15:16:33 +0000
Message-ID: <18607-651aa996c1e71d48@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18607
Logged by:          Sanskar Agrawal
Email address:      sanskar@flintk12.com
PostgreSQL version: 15.0
Operating system:   MacOS
Description:        

Min Reproducable env :

Consider the query below -> 

"
CREATE OR REPLACE VIEW v3.temp_view AS
SELECT * FROM users WHERE id = 'e-1'
UNION ALL
SELECT * FROM users WHERE id = 'e-2';
"

groups.id is a primary key and has a unique index defined on the same.

Either way when the view is created, the indexes and the related relations
of the foreign key references are being dropped. 
(Same with "UNION").

What + Why? I am processing the result of the union in another CTE which now
is not having access to indices and so it is performing a seq scan!



view thread (6+ messages)  latest in thread

Message-ID: <18607-651aa996c1e71d48@postgresql.org>
Permalink:  ../18607-651aa996c1e71d48@postgresql.org/
Also on:    postgresql.org/message-id/18607-651aa996c1e71d48@postgresql.org

 · 

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: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, sanskar@flintk12.com
  Subject: Re: BUG #18607: UNION ALL discards all foreign key relations + indexes
  In-Reply-To: <18607-651aa996c1e71d48@postgresql.org>

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

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