postgresql - Rows sorting changes after updating a column not related to sorting at all -


have orm generated sql this:

select * "games" "competition_id" in (select "id" "competitions" "id"  in (1,2,3)) order "date" limit 10 

it displaying rows 1 10.

however after:

update "games" set "season_id"=2 

same select returns rows 1,2,3 ... 11, 12 instead of 1,2,3 ... 9, 10

yes, returned rows still 10, last ones replaced ones after 10...

limit doesn't guarantee rows returned if multiple matching results exist within order by scope. if have more 10 rows same date, or if have different dates happens 9th, 10th, 11th , 12th rows have same date, aren't guaranteed consistent results returned 9th , 10th slots. postgresql choose these @ own discretion - change when records updated.

try adding id order list fix this.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -