Re: Adding column in a recursive query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ibrahim Shaame <ishaame(at)gmail(dot)com>
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 14:31:18
Message-ID: 2006840.1774881078@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message hubert depesz lubaczewski 2026-03-30 14:52:33 Re: Adding column in a recursive query
Previous Message Ibrahim Shaame 2026-03-30 14:22:53 Re: Adding column in a recursive query