Re: Using "object orientated" tables?

Поиск
Список
Период
Сортировка
От Simon Connah
Тема Re: Using "object orientated" tables?
Дата
Msg-id yqMVDoZMX_lqEXTkqNcMxTbTKwiU0lPpdzC4_wv1aHpI1tnGzN9nTDZfrBi2-Zm4bFgT-dzuT-ISCtB1_VnZ39BCAQA0Rhj5OhD-y46-Il0=@protonmail.com
обсуждение исходный текст
Ответ на Re: Using "object orientated" tables?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-novice
------- Original Message -------
On Wednesday, May 11th, 2022 at 02:43, David G. Johnston <david.g.johnston@gmail.com> wrote:

On Tue, May 10, 2022 at 6:33 PM Simon Connah <simon.n.connah@protonmail.com> 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.

Thank you for your reply. That makes more sense. I'll eventually get the hang of things!

Simon.
Вложения

В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Using "object orientated" tables?
Следующее
От: Simon Connah
Дата:
Сообщение: Re: Using "object orientated" tables?