PSQL: Upper-case column names *must* be qualified with double-quotes

Ref: https://www.xspdf.com/resolution/53039249.html
This commit is contained in:
Oliver Walters 2021-02-03 13:16:32 +11:00
parent 0e246a7fdf
commit 5e9097b5e0

View File

@ -22,7 +22,7 @@ def reverse_association(apps, schema_editor):
cursor = connection.cursor()
response = cursor.execute("select id, MPN from part_supplierpart;")
response = cursor.execute('select id, "MPN" from part_supplierpart;')
supplier_parts = cursor.fetchall()
# Exit if there are no SupplierPart objects
@ -105,7 +105,7 @@ def associate_manufacturers(apps, schema_editor):
cursor = connection.cursor()
response = cursor.execute("select id, MPN from part_supplierpart;")
response = cursor.execute(f'select id, "MPN" from part_supplierpart;')
supplier_parts = cursor.fetchall()
# Exit if there are no SupplierPart objects
@ -317,7 +317,7 @@ def associate_manufacturers(apps, schema_editor):
# Extract all SupplierPart objects from the database
cursor = connection.cursor()
response = cursor.execute("select id, MPN, SKU, manufacturer_id, manufacturer_name from part_supplierpart;")
response = cursor.execute('select id, "MPN", "SKU", manufacturer_id, manufacturer_name from part_supplierpart;')
results = cursor.fetchall()
part_count = len(results)