-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Fixed #470 -- Added support for database defaults on fields. #16092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dd8ae3e
to
bc7a375
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In good shape! Some comments from pair review at the Djangocon Europe 2022 sprints...
441ea31
to
54c2bb9
Compare
2f37f0b
to
74711c9
Compare
This SQL is generated by Django for Oracle, but leads to the INSERT INTO "FIELD_DEFAULTS_DBARTICLE" ("HEADLINE", "PUB_DATE")
SELECT * FROM (SELECT DEFAULT col_0, TO_TIMESTAMP(DEFAULT) col_1 FROM DUAL
UNION ALL SELECT DEFAULT, TO_TIMESTAMP(DEFAULT) FROM DUAL) The relevant python code: class DBArticle(models.Model):
headline = models.CharField(max_length=100, db_default="Default headline")
pub_date = models.DateTimeField(db_default=Now())
def __str__(self):
return self.headline articles = [DBArticle(), DBArticle()]
DBArticle.objects.bulk_create(articles) What I'm not yet clear on is: |
I can work around the above error somewhat by setting
|
I currently suspect that we can't use the I'm wondering if the best fix here is to change how we handle Oracle bulk inserts to use the INSERT ALL
INTO mytable (column1, column2, column_n) VALUES (expr1, expr2, expr_n)
INTO mytable (column1, column2, column_n) VALUES (expr1, expr2, expr_n)
INTO mytable (column1, column2, column_n) VALUES (expr1, expr2, expr_n)
SELECT * FROM dual; which I hope parallels single inserts sufficiently to support |
This looks like a nice feature, but someone reading the documentation (me included) might be wondering what is the recommended argument to use ( |
927e510
to
026fb7d
Compare
@felixxm I've fixed the Oracle failures, but unfortunately this has left
For some reason, occasionally the |
This comment was marked as outdated.
This comment was marked as outdated.
22d5d84
to
5b3e47d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LilyFoote Thanks 👍 I left initial comments.
4354606
to
f713b11
Compare
26c57e1
to
9643d8e
Compare
Pushed set of small changes, 64% reviewed 😅 Tomorrow I want to start working on tests and docs. |
In the light of ticket-34553 and whole saga of |
Added tests. It's funny because they work in almost all cases 😄 The only exception is the single quotation mark |
212ae5c
to
9cb8c3d
Compare
buildbot, test on oracle. |
22e1089
to
9c9706b
Compare
I noticed that inserting primary keys with |
1dc0ef4
to
1c99e09
Compare
I pushed final edits 🚀 @LilyFoote Thanks for your humongous efforts 🥇 🌟 |
“Festina lente”, or “more haste, less speed” 🐢 🏅 Thank you @LilyFoote and @felixxm ! 🤘 |
Special thanks to Hannes Ljungberg for finding multiple implementation gaps. Thanks also to Simon Charette, Adam Johnson, and Mariusz Felisiak for reviews.
https://code.djangoproject.com/ticket/470
Rebased from #13709.