| From: | Ibrahim Shaame <ishaame(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | depesz(at)depesz(dot)com, "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Adding column in a recursive query |
| Date: | 2026-03-30 15:11:08 |
| Message-ID: | CAJOWwD6GpzqUjz6dn+3ye2fRz83EK6eb_buZ18bv4f_iENTJOw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
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?
Thanks again
Ibrahim
On Mon, Mar 30, 2026 at 5:31 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Ibrahim Shaame <ishaame(at)gmail(dot)com> writes:
> > Thanks for the reply. Both are integers and they work well without the
> two
> > lines. So what changed one of them to text. Can you see where? I have not
> > been able to identify.
>
> This bit is forcing the column names for just the first three
> output columns, leaving the rest to default from the SELECT
> targetlist:
>
> WITH RECURSIVE x(jina, namba, nasaba_1) AS (
>
> That's a hazardous practice: usually I'd force all or none of
> the column names that way. In this case, I speculate that you
> carelessly added the new column as one of the physically first
> three SELECT outputs, and didn't adjust this list to match,
> leading to confusion about which column is "x.namba".
>
> If that's not it, you need to be a great deal more specific
> about exactly how you changed the query.
>
> regards, tom lane
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David G. Johnston | 2026-03-30 15:18:09 | Re: Adding column in a recursive query |
| Previous Message | hubert depesz lubaczewski | 2026-03-30 14:52:33 | Re: Adding column in a recursive query |