I'll try to explain what happend to me without pasting every single piece of my code because it's a lot.
If I run this query alone it returns 6.0 (the expected behaviour)
select distancia_euclediana_para_imagenes(vector_cuadrante1,
vector_cuadrante2,
vector_cuadrante3,
vector_cuadrante4,
ARRAY[SQRT(8),SQRT(8)],
ARRAY[SQRT(8),SQRT(8)],
ARRAY[SQRT(8),SQRT(8)],
ARRAY[SQRT(8),SQRT(8)])
from imagen,pivotes
where id=id_imagen and indice_pivote=2
and if I run this other query it returns 2 (again the expected behaviour)
with distancia_a_pivote(distancia) as
(select distancia_euclediana_para_imagenes(vector_cuadrante1,
vector_cuadrante2,
vector_cuadrante3,
vector_cuadrante4,
ARRAY[SQRT(8),SQRT(8)],
ARRAY[SQRT(8),SQRT(8)],
ARRAY[SQRT(8),SQRT(8)],
ARRAY[SQRT(8),SQRT(8)])
from imagen,pivotes
where id=id_imagen and indice_pivote=2)
select id from imagen, indice, distancia_a_pivote d
where id=id_imagen and
fqa[2]>= 6-1 and
fqa[2]<= d.distancia+1;
However, with this little change it stops working and returns nothing
with distancia_a_pivote(distancia) as
(select distancia_euclediana_para_imagenes(vector_cuadrante1,
vector_cuadrante2,
vector_cuadrante3,
vector_cuadrante4,
ARRAY[SQRT(8),SQRT(8)],
ARRAY[SQRT(8),SQRT(8)],
ARRAY[SQRT(8),SQRT(8)],
ARRAY[SQRT(8),SQRT(8)])
from imagen,pivotes
where id=id_imagen and indice_pivote=2)
select id from imagen, indice, distancia_a_pivote d
where id=id_imagen and
fqa[2]>= d.distancia-1 and
fqa[2]<= d.distancia+1;
I'll be grateful if you could help me because I have no idea what can cause this issue. Besides I've been coding in a TDD style, so I have tests to prove the right behaviour and I was pretty it was going to work
Thanks
fqa[2]? The integer 5 perhaps?