News for hackers. Stuff that matters.
Re:Why favor PostgreSQL over MariaDB/MySQL? by pmontra on Tuesday September 05, 2017 @02:54AM (#15173037)
The data should be handled by the database, especially when there might be many different applications accessing it. Think of microservices, maybe written in different languages and frameworks, plus some devops running queries by hand on the db.

The ability to stop modifications inside the db is the ultimate safeguard against data corruption. If you really value your data you should also implement validations with CHECK statements and not only in the application. Think about the database as another microservice worth its own logic.

Re:Why favor PostgreSQL over MariaDB/MySQL? by jstewartmobile on Tuesday September 05, 2017 @03:50AM (#15173270)
You are correcting something I never said. MySQL has primary/foreign key checking, field validation, transactions, etc. I have nothing against RDBMSes. I like them!

I'm talking about not doing shit like XML parsing (https://www.postgresql.org/docs/9.6/static/functions-xml.htm...), or LDAP queries (https://docs.oracle.com/cd/B10501_01/network.920/a96577/dbms...) in the database. I don't think those things belong there.

Serves me right for leaving a blank on HN! People here just love to fill those with 'herp derp'.

Re:Why favor PostgreSQL over MariaDB/MySQL? by kuschku on Tuesday September 05, 2017 @07:45AM (#15174232)
XML parsing definitely belongs into a major database. There’s a lot of legacy tools using XML databases, and supporting them is useful. (And they are not technically bad either)
Re:Why favor PostgreSQL over MariaDB/MySQL? by pmontra on Tuesday September 05, 2017 @05:09AM (#15173562)
I agree that they don't belong to databases. There might be use cases or there where it's ok to do that but I never run into them.
Re:Why favor PostgreSQL over MariaDB/MySQL? by concede_pluto on Tuesday September 05, 2017 @03:42AM (#15173237)
This. You don't want to reimplement all your validation in each of your applications (plural!), and you're in for a nasty surprise if you think your entire organization has only one application using your database now and forever.
Re:Why favor PostgreSQL over MariaDB/MySQL? by pmontra on Tuesday September 05, 2017 @05:16AM (#15173584)
Actually you probably should.

Front end (JS SPA) for the convenience of users.

Back end API (any web framework) for the convenience of developers, the users of the API.

The database to make sure nobody can corrupt the data.

In my experience the validations in the database almost never go past foreign keys, null fields and bounds on numeric data.

Anecdote. I remember when the consensus of Rails developers was not to use foreign keys: Rails didn't have a way to define them so they probably didn't matter, right? I laughed and added them to every application of mine. Rails has foreign keys now, maybe since version 3.

There are some gems to generate CHECK statements from validations.