public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Simon Connah <[email protected]>
Cc: pgsql-novice <[email protected]>
Subject: Re: Using "object orientated" tables?
Date: Tue, 10 May 2022 18:43:08 -0700
Message-ID: <CAKFQuwZMze+X-pVSNTWkY+vV3pFrX1S-kC0WCr4FGupzignhjA@mail.gmail.com> (raw)
In-Reply-To: <FD4Iyd89i-sbetQTcbUPO1SqWrYMGhzyso4ltpYmvWiI5LtHUxnPZNCyoJOhMOr3aQqvSKR9pISe55L3HStXrim-Q2wuufRQFkjGtAjIyS8=@protonmail.com>
References: <FD4Iyd89i-sbetQTcbUPO1SqWrYMGhzyso4ltpYmvWiI5LtHUxnPZNCyoJOhMOr3aQqvSKR9pISe55L3HStXrim-Q2wuufRQFkjGtAjIyS8=@protonmail.com>

On Tue, May 10, 2022 at 6:33 PM Simon Connah <[email protected]>
wrote:

> Hi,
>
> I was wondering what the community thought of using table inheritance in
> PostgreSQL? Is it considered bad practice these days?
>
> Basically, I have a users table and every user has a unique, not null UUID
> which is used as the primary key. There are only three columns on the
> table. User ID, Username, Email.
>
> Having said that I'll have to store data about them which I don't want to
> do in one massive table as it would be ugly as hell. So what I want is my
> main user's table to stick to three columns and then sub-tables which
> inherit from it to add their own column? So for instance I might want to
> store an account balance for people making money on my site.
>
> Hopefully, I've managed to explain what I mean properly. If you need any
> extra information then let me.
>
>
I wouldn't use inheritance, especially since I do not want to carry around
copies of Username and Email.  Having a "core data" users table then adding
additional one-to-one related tables based upon application needs is quite
common.

David J.


view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Using "object orientated" tables?
  In-Reply-To: <CAKFQuwZMze+X-pVSNTWkY+vV3pFrX1S-kC0WCr4FGupzignhjA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox