security – “Value out of range: overflow” error when executing SQL query on Postgresql

I’m experiencing an issue with executing an SQL query for an internal CTF lab that’s giving me the “value out of range: overflow” error.
The query is this :

update users set active = true where id = INJECTION

My objective is to trigger and error condition so I used this:

update users 
  set active = true 
where id = (select (case when (select 0)=1 then (select pow(999,9999)) else 10 end)); 

—> ERROR: value out of range: overflow

while

update users 
  set active = true 
where id = (select (case when 0=1 then (select pow(999,9999)) else 10 end)); 

–> no error

why this? 0=1 is false why the subquery with the pow function is executed?

Read more here: Source link