﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18738	manage.py loaddata returns 0 despite fixture load failure	Lorin Hochstein	nobody	"I tried to load some fixtures with the PostgreSQL backend and got an integrity error because the fixtures were in the wrong order:

{{{
$ python manage.py loaddata fixtures.yaml
Problem installing fixture 'fixtures.yaml.bz2': Traceback (most recent call last):
  File ""/Users/lorin/.virtualenvs/venv/src/django/django/core/management/commands/loaddata.py"", line 226, in handle
    connection.check_constraints(table_names=table_names)
  File ""/Users/lorin/.virtualenvs/venv/src/django/django/db/backends/postgresql_psycopg2/base.py"", line 129, in check_constraints
    self.cursor().execute('SET CONSTRAINTS ALL IMMEDIATE')
  File ""/Users/lorin/.virtualenvs/venv/src/django/django/db/backends/util.py"", line 40, in execute
    return self.cursor.execute(sql, params)
  File ""/Users/lorin/.virtualenvs/venv/src/django/django/db/backends/postgresql_psycopg2/base.py"", line 52, in execute
    return self.cursor.execute(query, args)
IntegrityError: insert or update on table ""shop_product"" violates foreign key constraint ""shop_product_product_ptr_id_fkey""
DETAIL:  Key (product_ptr_id)=(1) is not present in table ""shop_product"".
}}}

I expected the return code to indicate failure. However, it returned success:

{{{
$ echo $?
0	
}}}

This is problematic in environments when relying on the return code to indicate success or failure."	Uncategorized	closed	Uncategorized	1.4	Normal	duplicate			Unreviewed	0	0	0	0	0	0
