> Is there any good documentation, example, tutorial, pamphlet, discussion... to exploit pg
> features to obtain "polymorphic" behavior without renouncing to referential integrity?
>
> Inheritance seems *just* promising.
>
> Any methodical a approach to the problem in pg context?
I don't know if this is what you are after, but is was a VERY interesting discussion that sounds
similar to what your are looking for?
http://archives.postgresql.org/pgsql-sql/2006-05/msg00179.php
http://archives.postgresql.org/pgsql-general/2006-05/msg01125.php
basically the OP, wanted to create a template/parent schema.
next he would create a new schema for each client and then create inherited tables from the parent
schema.
Then he would create views/fuctions that would work on the tables in the current schema.
Last he would set the search_path to the schema of any client of enterest and use the default
views/funtions of the newly set search_path of currently set schema.
One advantage (possible the polymorphism you were looking for) with this design was that any
modifications made to the template/parent schema would cascade to all of the client schemas as a
feature of table inheritance. And he could also summarize all of the data from all clients by
selecting from the template/parent schema.
Regards,
Richard Broersma Jr.