&& Operator reorders the result

Why is the PostgreSQL 9.4 && operator used to check the overlap of two arrays, changing the order of the result?

I have a request

Select *  FROM "View_Student_Plan" WHERE  "ClassID" && ARRAY[53]:: bigint[] 

My opinion is sorted in the registration order. It works fine if I use

Select *  FROM "View_Student_Plan"

But when I attach the rest to the query, it changes the order of the result.

I used some other condition in where where, as Student_Name like 'P%',, then it does not affect the order of the result specified by the select statement. Then why not for"ClassID" && ARRAY[53]:: bigint[]

+4
source share
1 answer

- ! , , ETC..

(E.G. ) - ORDER BY.

: , VIEW ORDER BY, , , .
.

SELECT * FROM YourView
ORDER BY....--THIS WILL WORK

:

SELECT * 
FROM (SELECT * FROM ....
      ORDER BY ..)

, .

+6

Source: https://habr.com/ru/post/1664396/


All Articles