public inbox for pgsql-novice@postgresql.org  
help / color / mirror / Atom feed
From: David G. Johnston <david.g.johnston@gmail.com>
To: Ibrahim Shaame <ishaame@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: depesz@depesz.com <depesz@depesz.com>
Cc: pgsql-novice@lists.postgresql.org <pgsql-novice@lists.postgresql.org>
Subject: Re: Adding column in a recursive query
Date: Mon, 30 Mar 2026 08:18:09 -0700
Message-ID: <CAKFQuwagw6CHy9qOVeDYeNa3_r8DpVTaR-u_xE9vGgw0EXQ7Sg@mail.gmail.com> (raw)
In-Reply-To: <CAJOWwD6GpzqUjz6dn+3ye2fRz83EK6eb_buZ18bv4f_iENTJOw@mail.gmail.com>
References: <CAJOWwD5_saumY5Xv1QAQ=VxwMQrz-tF6G-Fwek-ew52-=_uOXg@mail.gmail.com>
	<acppj9U8zquc2O7z@depesz.com>
	<CAJOWwD5XcMzwMrkaL-vD8d553y0BzQBppObZhau6zYxA4hj5nw@mail.gmail.com>
	<2006840.1774881078@sss.pgh.pa.us>
	<CAJOWwD6GpzqUjz6dn+3ye2fRz83EK6eb_buZ18bv4f_iENTJOw@mail.gmail.com>

On Monday, March 30, 2026, Ibrahim Shaame <ishaame@gmail.com> wrote:

> Effectively, after removing the column names from x(jina, namba,
> nasaba_1) it works now. Thank you very much. But then I don't understand
> the advantage or inconvenience of naming or not naming the columns there.
> Is there any explanation somewhere?
>

SQL is big on providing ways to give aliases/names to things.  It just
boils down to readability or, more often, conventions, as to which ones to
use.  The CTE column names clause doesn’t get used much that I have seen.
You have to write a full query inside the CTE anyway so column aliases are
more conventional.

David J.


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-novice@postgresql.org
  Cc: david.g.johnston@gmail.com, ishaame@gmail.com, tgl@sss.pgh.pa.us, depesz@depesz.com, pgsql-novice@lists.postgresql.org
  Subject: Re: Adding column in a recursive query
  In-Reply-To: <CAKFQuwagw6CHy9qOVeDYeNa3_r8DpVTaR-u_xE9vGgw0EXQ7Sg@mail.gmail.com>

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

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