
If you ever want the data in the table to be changed (in case the new rules are violated), you have to tell PostgreSQL explicitly what you want: PostgreSQL It will error out and inform us that the change is really not possible because there is data, which simply has to be protected. PostgreSQL does what I personally expect from a database. Do you notice the “minor difference”? If this was your bank account? Would you care? If this database was powering the machine keeping a sick child alive – would you still trust it, or would you demand a replacement? If your life depends on data – would you accept a silent change in the content of a table? Maybe I am too conservative, but I would not. Remember, the original value inserted into the table was 1234.5678. Test=# INSERT INTO data VALUES (1, 34.5678) ĭETAIL: A field with precision 3, scale 2 must round to an absoluteĪgain, MySQL / MariaDB will actually change your data. Query OK, 1 row affected, 1 warning (0.06 sec)
MySQL / MariaDB: Taking existing data seriously MySQL / MariaDB Lesson learned: PostgreSQL takes your data structures seriously. If you shot yourself in the head there is no point in having a warning that “you might be dead now” – it is better to prevent the thing from happening in the first place.
Storing data is not about “tolerance” – it is about correctness. There is most likely a reason why the column was defined the way it is. The behavior shown by PostgreSQL in this example is correct for a variety of reasons: Instead of one million you just ended up getting 9999.99 because the field was not large enough. Why does that matter? Suppose you have won the lottery. Yes, MySQL / MariaDB do issue a warning but at the end of the day the data in the table is not what it is supposed to be. What you see here, is that PostgreSQL errors out because the data you are trying to put into the table does not conform to the data type of the column, while MySQL / MariaDB will silently change your data. Query OK, 1 row affected, 1 warning (0.01 sec)ĭETAIL: A field with precision 4, scale 2 must round to an absolute MySQL / MariaDB: Data type handling MySQL / MariaDB However, it should be enough to convince people and help decision makers: PostgreSQL vs. Keep in mind: This posting is simply a “best of” and by far not a complete list. The idea of this post is to collect some examples, which show on a technical level, why you might want to go for PostgreSQL. So I thought I’d bring up some good ideas, why it is actually more desirable to use PostgreSQL in favor of MySQL / MariaDB. Arguments like that tend to be no brainers and we (the PostgreSQL community) are really able to do a lot better. Many people are not happy with statements such as “PostgreSQL is just better”. Since the introduction of MariaDB I have the personal feeling that the technology is not really finished yet and that people are still asking for MySQL / MariaDB and are interested in comparing PostgreSQL to those technologies. But, after Oracle took over MySQL I had the feeling that the star of MySQL was somewhat fading. #Pgadmin 4 postgresql 11.2 support professional
In my judgement (which is of course a bit biased) PostgreSQL always served my professional users, while MySQL had a strong standing among web developers and so on.
For many years, MySQL and PostgreSQL were competing databases, which addressed slightly different audiences.