Re: BUG #18607: UNION ALL discards all foreign key relations + indexes - Mailing list pgsql-bugs

From hubert depesz lubaczewski
Subject Re: BUG #18607: UNION ALL discards all foreign key relations + indexes
Date
Msg-id Zt_wyM5koKKmOmdn@depesz.com
Whole thread Raw
In response to BUG #18607: UNION ALL discards all foreign key relations + indexes  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Mon, Sep 09, 2024 at 03:16:33PM +0000, PG Bug reporting form wrote:
> 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.

What is groups? Your view is named "temp_view", and it's using "users",
not "groups".

> 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 do you mean dropped? You had index on column id in table users, and
after view creation you don't have anymore?

Can you please show full example, that I can run on empty database, that
exhibits the problem?

Best regards,

depesz




pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [EXT]: Re: BUG #18604: Regression in PostgreSQL 16.4: pg_dump Prevents Essential System Table Modifications
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: BUG #18607: UNION ALL discards all foreign key relations + indexes