Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7EH2-0055sv-1v for pgsql-novice@arkaria.postgresql.org; Mon, 30 Mar 2026 15:11:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7EH1-004EDX-0K for pgsql-novice@arkaria.postgresql.org; Mon, 30 Mar 2026 15:11:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7EH0-004EDK-2K for pgsql-novice@lists.postgresql.org; Mon, 30 Mar 2026 15:11:27 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7EGz-00000001p2g-1ede for pgsql-novice@lists.postgresql.org; Mon, 30 Mar 2026 15:11:26 +0000 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-35d9923eec5so1189114a91.2 for ; Mon, 30 Mar 2026 08:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774883484; cv=none; d=google.com; s=arc-20240605; b=GhxhQ+3g6cl7q3DTYHG1+hxMssU4f2bqDpB4nszbjGG3+1bc+3ts9WvtL+IaV1iaMc E2fvIW5Ft/bNzy4qIi0U/dihX6Xj1xRoLXCqL9sDOU0/b51I7g8vEv8HWi43vy/WushF Urj2GgdxhWVtygxyeDqp98NnKm+BeoIv8Dec+73eVhNBzyswX4b4K2K4PRw1xZSUb2ER EjSN3FkOWm3fxmGDJiGIXpDYrcmRxNcwFTv720tk3rp04ellx5eEHwn1I4sALMosNqmc qf6d8S4ayYQjCDrNyzzI3mjKSnm0mjEQxM8Xb70KYHlU0ek9rBEK19PhD1ozefaeBbZx krMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=DuaPCoAA+NNiqPplvjdStUkOOkxQUjNx0wBIyzwrmYQ=; fh=dv7iTpHvfNdZ0ipsFP7qlbxtDv8Jk5eZOmxSNL2C/hU=; b=Tsd39r3q8JZrgWVQ4Gilw6EngWZzQXm4ZXEwHXr8r21ATc+5aQiKBQD3OpIOHFKB9t 2looOPbFVBOnA7+SejBJqwCeVWXTLDVx4y0mvlLBhXBcplL7sK7S/VIdMPvDhNScEbnV tHcjpuq8qhDRhHbXzus8HmqMfTEJzldOgFAD4yxvwH4piJYUsr/9nKnggJmSK6Z4wq9p ebE2TtYq92QE9k5nPw0NMYwlBRnWCd85+cexJ3scUG5QR7f6EWGA6+eHY8+jePc5p5Ha OhlNbYe29lCZ89drzDpHqAl0gpMB31FrIA1ZG+axI7nvZi7lklbB0TGVb4H0CWIIIdW1 RblA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774883484; x=1775488284; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DuaPCoAA+NNiqPplvjdStUkOOkxQUjNx0wBIyzwrmYQ=; b=sKm18p0wBmBu4uThWqPbrugG3Ct4RFaDeODVOFHT4EB7cpD7nkDwv69MTPNBcPpEYi tcV0dMlDD6bpkG+wicCkQQpjNwJ7pY7iU0qUQ2sV9MZMIchAEETVBgNUeaYoImAV8B+Y M4QH7XXi4UKt48fmc1U8WH1QBLnTqzjM8PsyW0oOymAirAd//XgYpJINzK1rbGKWC8Td zhEhCRiXBogWO5IdJhGovsPVmje0vRA7JwTjFePpBtt7JblcVFdF9lFlCnFCy9nQy9rc 20NnWBevyFcp7aP71u34GVGHk12mAcOb+gPTuyK11WpGMDw0J20Eg3arFAhxp2EoShBx 2Krg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774883484; x=1775488284; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DuaPCoAA+NNiqPplvjdStUkOOkxQUjNx0wBIyzwrmYQ=; b=AaRjzxARTDUmkdsQoReTw0O/FtiqPuD8PH6OQl7rEodJb5N6FuKYfHdrsaXe1nf06t EAXzJJ9dHx759UqRrA8iASJsPyOUQ67SpmOLrhQ7tMaxE5iRasVY8FTbTw9nwCtApmCW B9aW+p/yUwdIAaVE2vbkmpkrc7r7X/Q8NIZkAQ3Dsx5v5OpTuuQAo5ch6jfO9HSl5+Ux 36Yw10Wej0tRdm3qL77Y5+AImVCiu8/JitRrM04uypLsuurQEU+jhtXhLlgHhol/SFXT FikZ2GJRZwAIh/G61RwuP18jGgt3LVIGBgdOcZgkvPRpqTP/JX4UsoMgSWA+Yxr78xNn NfBA== X-Forwarded-Encrypted: i=1; AJvYcCXOZX+wMvoRKrP19rXHo44yLiXKxDEO3BnF8uxV5qB3PnALMcWQ7cNJRHDAkKXcRCaoYH2828CJALUVo6w=@lists.postgresql.org X-Gm-Message-State: AOJu0YxC+UJBT68I2TBGRYADhcBZRH6Ov1/UmkGUkM3FHeLlf4phnPaH z/3HivbzOCZQjcEd7agwPsf0vNzXiU0oyLZ9/YblOPIaIny2dB8fcjMotA0qNwRg4yic1SEeeAs 6Z19IWb/J/w8i+rck6etFrUHuZRLRpRd1KYnw X-Gm-Gg: ATEYQzz5apRzrFdKqgKlGkmBeDtHtblqXkKS/3zS1BP3qlP5+wq5cjr2Rvd9QMwMfIv LftKkX4hGWbL52G0fir/zb8vONTfr5z0WXAz8pc3ft1KrFZI+zEXpZCX1nC6PfqBvUjcjAJYeQh HruO9R2vNNnA1mYhVgIcaPzDPyK1j/8Uz5pQqJI45gYJ0BuVTk+p6yGFd5KRcUG3wOnwNGaQk0q lkVFQxaMpdxhkpWc5FfDVq58gSErqc0883xB34rm3Pm3vpylbaFADhnkhkcPL5wibbYl1A+pAjX n4vD3dRIvdx4x+D/LXUGjyA1q5wFNj8v+XtAgmO6 X-Received: by 2002:a17:902:f64e:b0:2b2:4a9a:b149 with SMTP id d9443c01a7336-2b24a9ab455mr65171585ad.9.1774883484412; Mon, 30 Mar 2026 08:11:24 -0700 (PDT) MIME-Version: 1.0 References: <2006840.1774881078@sss.pgh.pa.us> In-Reply-To: <2006840.1774881078@sss.pgh.pa.us> From: Ibrahim Shaame Date: Mon, 30 Mar 2026 18:11:08 +0300 X-Gm-Features: AQROBzCSfR7HRiLk8g35x8BnGDg4Yl1h8h8x0o0d4JwnIPHvtrxbb2Vog-Ew96g Message-ID: Subject: Re: Adding column in a recursive query To: Tom Lane Cc: depesz@depesz.com, "pgsql-novice@lists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000009b3230064e3f431b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000009b3230064e3f431b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E2=80=AFPM Tom Lane wrote: > Ibrahim Shaame 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 n= ot > > 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 > --0000000000009b3230064e3f431b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Effectively, after removing the column names from x(<= span class=3D"gmail-im">jina, namba, nasaba_1) it works now. Thank you very= much. But then I don't understand the advantage or inconvenience=C2=A0= of naming or not naming the columns there. Is there any explanation somewhe= re?

Thanks again
Ib= rahim

On Mon, Mar 30, 2026 at 5:31=E2=80= =AFPM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Ib= rahim Shaame <ish= aame@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:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 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.=C2=A0 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.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 regards, tom lane
--0000000000009b3230064e3f431b--