Just to give an idea about the quality of PostgreSQL codebase:
At some point in PostgreSQL's history some of the developers took the code and developed for themselves. Later this version became known as Informix, the worlds leading database (ie: bigger than oracle and bigger than DB2 (which is why IBM bought Informix))
Informix and PostgreSQL still share quite a lot of functions and 'ways of doing things'
The big difference between PgSQL and MySQL is that MySQL was designed only for speed, whereas PostgreSQL was designed to give reliable access to consistent data.
MySQL's filosofy is not to be good or reliable, but just to be fast.
MySQL let's you do impossible things and silently tries to correct your mistakes, and it will wing the rest. For example, MySQL will let you do stupid things like:
SELECT username, COUNT(1)
FROM tabel
GROUP BY gender;
This query is obviously not possible, yet mysql happily executes it, returning some results that are completele bollocks, but none of the mysql users seem to notice.
The most often used argument for mysql and against PostgreSQL is that mysql is faster.
And this is mostly true. MySQL is faster than postgreSQL, but only at the things that MySQL can do.
MYSQL was designed for speed, and you can only be faster than your competitors if you do less work than your competitors. MySQL have eliminated all the features that 'slow the query down'. The result: lightning fast queries. The side effect: The queryes have to be very very very simple.
And using very very very simple queries means that you have to do much much much more work in your script. All the functions that real databases can do inside the database have to be done in your application.
Again, none of the mysql users seem to notice this, they just see that a query under postgresql takes longer than under mysql. They don't see that the extra time that PostgreSQL might take is spent on making sure that the data is safe, and they don't see that they spend hours writing routines to do things that PostgreSQL does inside the database.
For example; the lack of cascading delete in mysql (which is only available in the latest MySQL versions in a limited way) means that you as a programmer have to run multiple queries to safely remove records that have dependancies, and the lack of transactions means that if you make a typo in one of those queries, your data is corrupt because half of it was deleted and the other half was not. Time for backuptapes.
Again none of the mysql users seem to notice/care. All they see is that their queries are very fast.
MySQL also has some very strange ideas about kolumn types.
Ever notices that if you have CHAR columns, and you add a VARCHAR column, that suddenly all your CHAR columns change to VARCHAR? MySQL's insane theory is that if you have one variable length field in a table, you might aswell make them all variable because the speed advantage of using fixed length fields is gone once you have one VARCHAR. The fact that CHAR gives completely different results from VARCHAR seems to be unknown to them. So what if your applications f*cks up, MySQL is not for quality, only speed.
Right now the only real missing feature in postgresql is replication, you need third-party software to do that. But then again, PostgreSQL can handle so much more than MySQL that you can probably survive very well on just one server anyway 🙂