First-class Polymorphic joins?

From: Guyren Howe <guyren(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: First-class Polymorphic joins?
Date: 2015-08-14 00:23:01
Message-ID: EAB98192-33B0-4BB8-8F85-E939DD079675@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It surprises me that no SQL database to my knowledge has polymorphic joins as a first-class feature.

A polymorphic join is where a fk contains not just an id but an indicator of which table it refers to. So you could have a "tags" table, that can attach tags to any of a variety of other tables. Rails handles this by including the table name as a string.

This seems a reasonable thing to want to do, and it seems that the database could handle it by combining the fields from the target tables in the result.

I also think migrations ought to be a first-class feature…

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martín Marqués 2015-08-14 00:37:05 Migrations (was: First-class Polymorphic joins?)
Previous Message Martín Marqués 2015-08-14 00:22:41 Re: Sync replication + high latency server