Re: Adding column in a recursive query

From: Ibrahim Shaame <ishaame(at)gmail(dot)com>
To: depesz(at)depesz(dot)com
Cc: "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:22:53
Message-ID: CAJOWwD5XcMzwMrkaL-vD8d553y0BzQBppObZhau6zYxA4hj5nw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello Hubert.
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.
Regards
Ibrahim

On Mon, Mar 30, 2026 at 3:16 PM hubert depesz lubaczewski <depesz(at)depesz(dot)com>
wrote:

> On Mon, Mar 30, 2026 at 01:20:14PM +0300, Ibrahim Shaame wrote:
> > I have a working recursive query. I want to add another column, but it
> > gives me an error:
> > ERROR: operator does not exist: integer = text
> > LINE 21: WHERE e.nasaba_1 = x_1.namba
> > ^
> > HINT: No operator matches the given name and argument types. You might
> > need to add explicit type casts.
> > Any suggestion of where I am doing it wrong?
>
> You can't compare text and integer.
>
> Does 'abc' equal 0 ?
> What about '01' and 1 ?
>
> Cast one side to the type of the other. Or, better yet, normalize
> datatypes in tables, so that you don't have to compare across types.
>
> Best regards,
>
> depesz
>
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2026-03-30 14:31:18 Re: Adding column in a recursive query
Previous Message hubert depesz lubaczewski 2026-03-30 12:16:15 Re: Adding column in a recursive query