Your database is your business logic. From constraints to the queries you write, it's all business logic.
Regardless, you misunderstood the article. This is about moving formatting into the db layer. Letting Postgres return JSON, as opposed to middleware code to translate rows to JSON.
Which is like the opposite of business logic code.
As far as automatic tests for dbs - I have no idea what you are talking about unless you mean integration testing through a backend.
Automatic tests for a database could simply be writes followed by reads with expectations for the returned rows. This is how Postgres tests itself.
My personal go-to right now is ActiveRecord and RSpec. The examples could just as easily run raw SQL directly using the Ruby pg driver.
Since the application layer is much more naturally aligned with small well isolated chunks of logic it is easier to minimize the volume of code and logic in scope when testing a particular attribute - when that goes into the DB I've always seen things get more complex rapidly.
But this is not code, this SQL or equivalent, if SQL was known to be better than code to do busines logic everyone would do that.
What is your definition of code?
Plus, lots of those ORM things get plenty of hate from DBAs, I mean I like them but then again I'm not a very good programmer.
I am actually "good" at this stuff - writing logic in SQL through triggers, which call functions (at which SQL Server is way better than PG is) and stored procs, etc, and it's just a horrible, horrible practice.
More complex logic is a lot harder to maintain. You don't want to stress your DB's CPU if you can avoid it. You still need some kind of connection pooler anyway. There's a lot of reasons it doesn't make sense to put all your business logic in the DB. SQL is not the easiest language to maintain (not enough abstraction).
IMO the line to draw is just enough to keep data sanity.
Error states are a bit funky if you don't validate in the backend logic.
Sometimes business logic is implemented as rules, in which case the rules (configuration) can go into either configuration files or a database. But that doesn't make it data...
Meaning constraints and the model represent business rules.
Where exactly do you draw the line?
As a data fetching approach and especially as tooling primitive to eliminate the n+1 ORM problem this is a terrific tool to be aware of.
It only describes postgres native functions for formatting data.