Re: Server goes to Recovery Mode when run a SQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: PegoraroF10 <marcos(at)f10(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Server goes to Recovery Mode when run a SQL
Date: 2020-08-14 20:40:19
Message-ID: 658398.1597437619@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

PegoraroF10 <marcos(at)f10(dot)com(dot)br> writes:
> CREATE FUNCTION public.fntextonumero(finteger public.i32, ftext text)
> RETURNS boolean
> LANGUAGE sql STABLE
> AS $$
> SELECT ftext = finteger::text;
> $$;

Huh. The crash goes away if you change that to

SELECT finteger::text = ftext;

It looks like ExecInitSubPlan is just assuming that the outer side
of the hashable comparison condition is on the left, and this
function is confusing it by swapping that around to the right.
Kinda surprising that we never identified that problem before ---
this code's been like this for years.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Aleksey M Boltenkov 2020-08-15 05:35:29 bug in psql?
Previous Message Alvaro Herrera 2020-08-14 19:25:32 Re: Server goes to Recovery Mode when run a SQL