Same code, same database, different results on testing server and local server

Viewed 57

My local environment and my testing environment are both connected to the same database engine (postgresql) and have the same Django settings.

In my TableA, I have some duplicate rows and I only want to get the ones that belong to "category_1" with distinct "field1" values. So I do:

result = TableA.objects.filter(category='category_1').distinct('field1').order_by('field1')

This creates the query

SELECT DISTINCT ON ("TableA"."field1") "TableA"."id", "TableA"."category", "TableA"."field1" 
FROM "TableA" 
WHERE "TableA"."category"= "category_1"
ORDER BY "TableA"."field1"

The result looks correct on the local, but when I test it on my testing server the result still includes the rows that have the same "field1" values.

What could possibly go wrong??

0 Answers
Related