Re: PostgreSQL : bug (ou not) in CTE Common Table Expressions or Subqueries in the FROM Clause - Mailing list pgsql-general

From David Rowley
Subject Re: PostgreSQL : bug (ou not) in CTE Common Table Expressions or Subqueries in the FROM Clause
Date
Msg-id CAApHDvpULAMZ8JKX1zz12gqtXhCi+r9178pGq4C0ODjK9ZFvtA@mail.gmail.com
Whole thread Raw
In response to Re: PostgreSQL : bug (ou not) in CTE Common Table Expressions or Subqueries in the FROM Clause  (PALAYRET Jacques <jacques.palayret@meteo.fr>)
List pgsql-general
On Wed, 23 Mar 2022 at 04:03, PALAYRET Jacques
<jacques.palayret@meteo.fr> wrote:
> For example, in Oracle it is not possible to have a SELECT statement without a FROM clause (using DUAL table), so
maybe" ambiguous " columns are not handled in the same way.
 

But if your original complaint, the column was not ambiguous. The CTE
had no column named "id".

I really highly recommend that you write queries giving each relation
a short alias then make a habit to always prefix your column names
with the alias.  If you don't do this then you can have all sorts of
problems when you one day want to start dropping old unused columns
out of your tables.  If you alias these then dropping the columns will
properly cause queries that reference these columns to ERROR.  Without
aliases, your queries might just start doing something you don't want
them to do and you might not realise that for a very long time.

David



pgsql-general by date:

Previous
From: PALAYRET Jacques
Date:
Subject: Re: PostgreSQL : bug (ou not) in CTE Common Table Expressions or Subqueries in the FROM Clause
Next
From: Michael Paquier
Date:
Subject: Re: Can you install/run postgresql on a FIPS enabled host?