Move PosgreSQL's backend method relation_get to SQL function
Refactor relation_add prepearing to move SQL queries into functions
The four flavor's cases are made explicit to simplify the reading and the
definition of future SQL functions.
Move PosgreSQL's backend method relation_add to SQL function
Improve denormalized PostgreSQL schema to properly check for duplicates
Depends on D6084.