Polymorphic queries

From: Patric Bechtel <patric(dot)bechtel(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Polymorphic queries
Date: 2015-07-06 21:08:37
Message-ID: 559AEE55.4060407@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

maybe someone has an idea upon this:

I have a table which has quite a few inheriting tables which have inheriting tables etc (it's
mirroring a OOP model).

As expected, most queries are polymorphic, so they are going against the parent tables.

I'm searching for an idea how to query _once_ and, if the result hits one of the inheriting
tables, put the additional columns of them into a JSON or array structure, to avoid having to
query again to fetch the inheriting tables. I know that this would be possible with querying the
whole hierarchy via unions, but it seems extremely clumsy.

Does anyone have a solution for this or can push me in the right direction?

- --
tia,

Patric
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: GnuPT 2.5.2

iEYEARECAAYFAlWa7lUACgkQfGgGu8y7ypA5BACfY5oaQwRyvaF4QRdM2BG9Oj1p
HtMAoPNxCysjAeRAJOs5rVbqpoxRmF9M
=97f7
-----END PGP SIGNATURE-----

Browse pgsql-general by date

  From Date Subject
Next Message Michael Nolan 2015-07-06 22:16:27 Re: Average New Users Per DOW
Previous Message David G. Johnston 2015-07-06 20:50:12 Re: Average New Users Per DOW