Re: BUG #18607: UNION ALL discards all foreign key relations + indexes

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: sanskar(at)flintk12(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18607: UNION ALL discards all foreign key relations + indexes
Date: 2024-09-10 07:10:00
Message-ID: Zt_wyM5koKKmOmdn@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message hubert depesz lubaczewski 2024-09-10 07:13:00 Re: BUG #18607: UNION ALL discards all foreign key relations + indexes
Previous Message Thomas Munro 2024-09-10 00:43:16 Re: BUG #18146: Rows reappearing in Tables after Auto-Vacuum Failure in PostgreSQL on Windows