public inbox for pgsql-novice@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ibrahim Shaame <ishaame@gmail.com>
Cc: 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 10:31:18 -0400
Message-ID: <2006840.1774881078@sss.pgh.pa.us> (raw)
In-Reply-To: <CAJOWwD5XcMzwMrkaL-vD8d553y0BzQBppObZhau6zYxA4hj5nw@mail.gmail.com>
References: <CAJOWwD5_saumY5Xv1QAQ=VxwMQrz-tF6G-Fwek-ew52-=_uOXg@mail.gmail.com>
	<acppj9U8zquc2O7z@depesz.com>
	<CAJOWwD5XcMzwMrkaL-vD8d553y0BzQBppObZhau6zYxA4hj5nw@mail.gmail.com>

Ibrahim Shaame <ishaame@gmail.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





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

* 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