diff options
author | Alex Hill <alex@hill.net.au> | 2015-08-04 00:34:19 +1000 |
---|---|---|
committer | Josh Smeaton <josh.smeaton@gmail.com> | 2015-09-22 23:35:24 +1000 |
commit | 134ca4d438bd7cbe8f0f287a00d545f96fa04a01 (patch) | |
tree | 075ce7ffcc95819a0584e80f6611462894faea0c /django/db/backends/postgresql/operations.py | |
parent | 6e51d5d0e531c6aead9ebd638a63ffdc32245e5a (diff) | |
download | django-134ca4d438bd7cbe8f0f287a00d545f96fa04a01.tar.gz |
Fixed #24509 -- Added Expression support to SQLInsertCompiler
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r-- | django/db/backends/postgresql/operations.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index 866e2ca38b..3624c9cf56 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -221,9 +221,10 @@ class DatabaseOperations(BaseDatabaseOperations): def return_insert_id(self): return "RETURNING %s", () - def bulk_insert_sql(self, fields, num_values): - items_sql = "(%s)" % ", ".join(["%s"] * len(fields)) - return "VALUES " + ", ".join([items_sql] * num_values) + def bulk_insert_sql(self, fields, placeholder_rows): + placeholder_rows_sql = (", ".join(row) for row in placeholder_rows) + values_sql = ", ".join("(%s)" % sql for sql in placeholder_rows_sql) + return "VALUES " + values_sql def adapt_datefield_value(self, value): return value |