BUG #18038: Aliases removed from view definitions

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: asier(dot)lostale(at)openbravo(dot)com
Subject: BUG #18038: Aliases removed from view definitions
Date: 2023-07-27 06:29:32
Message-ID: 18038-c1613c6a9be9995d@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18038
Logged by: Asier Lostalé
Email address: asier(dot)lostale(at)openbravo(dot)com
PostgreSQL version: 16beta2
Operating system: Ubuntu 22.04
Description:

When defining a view in 16beta2, the sql representing that view removes
aliases. In previous versions those aliases where kept; furthermore, aliases
were added even if not defined.

In our case this is problematic as in our application we export view
definitions to text files to later import them, we support different
PostgreSQL versions and we would need to keep stable SQL among different
version (export <-> import).

For example:

create table test (c text);
create view test_v as select c from test;
create view test_v2 as select t.c from test t;

In PostgreSQL 16beta2:

\d+ test_v
...
View definition:
SELECT c
FROM test;

\d+ test_v2
...
View definition:
SELECT c
FROM test t;

In previous versions:

\d+ test_v
...
View definition:
SELECT test.c
FROM test;

\d+ test_v2
...
View definition:
SELECT t.c
FROM test t;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ba Jinsheng 2023-07-27 08:17:58 Question about double table scans for a table
Previous Message Gurjeet Singh 2023-07-27 01:43:18 Fwd: BUG #18016: REINDEX TABLE failure