-
Notifications
You must be signed in to change notification settings - Fork 124
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
Inconsistencies in default dates to 0000-00-00 and 1000-01-01 #328
Comments
From a position of almost complete ignorance, my vote for a default date is 0000-00-00 because 1000-01-01 is a valid date, which would be incorrect if the intent is "no date". However, if the amount of work to "undo" special handling of 1000-01-01 is significant, or inconsistencies between MariaDb and MySQL in this regard make 0000-00-00 problematic, I can accept 1000-01-01 for "no date" as simply being consistent is more important. Almost as important as the convention is how to document it. I suggest a developers' page in the wiki listing all conventions - keyword capitalization, spaces vs tabs, default date, etc. Cheers and best wishes to everyone for a healthy and prosperous New Year! |
Good catch @pakricard and great insights @dalers . As MySQL shifted from the zero date conventions some years back, this issue had been one of the headaches to deal with -- UPGRADE and MAINTAIN strategies we all do. I suggest the following, moving forward:
|
Hi @aingelc12ell : Thanks for the detailed info.
Then, probably move with the tide and apply 1000-01-01 as our existing 0000-00-00. The work to be done is not much either way: As I see it:
I think that's all. Let's wait a few more days if someone else has a different POV |
Hi all:
webERP has mixed code when date fields default to 0000-00-00 and 1000-01-01.
but:
So, in the latest code:
Then, we should all agree in using one format or another as default, for consistency and ease of maintenance of the code. I would go back to 0000-00-00 in all cases, as there will be minimal modifications in code and according to Gemini, there are no significant differences in favour of one or another.
Once agreed, I can take care of the code revision.
Thanks,
R
According to Gemini:
In MariaDB, neither
0000-00-00
nor1000-01-01
is inherently the "best" default date value. The most suitable choice depends on your specific use case and data requirements.0000-00-00
(Zero Date):SQL_MODE
setting. WithNO_ZERO_DATE
enabled, it's not allowed and will result in an error.1000-01-01
:DATE
type.Choosing the Best Default:
0000-00-00
can be a suitable choice, provided you handle it appropriately in your application logic.1000-01-01
or another relevant date can be used.SQL_MODE
setting in your MariaDB environment, as it can affect the usage of0000-00-00
.Example:
In this example,
1000-01-01
is used as the default value for thecreated_at
column, assuming it has a specific meaning in your application.Ultimately, the best default date value depends on your specific needs and how you intend to use the data.
The text was updated successfully, but these errors were encountered: