Re: Tricky SQL problem - retrieve information_schema info and make use of it.

From: Paul Linehan <linehanp(at)tcd(dot)ie>
To: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Tricky SQL problem - retrieve information_schema info and make use of it.
Date: 2016-03-22 15:46:02
Message-ID: CAF4RT5TNOgkrRoqzOx_G424edS607YsX=GSSyqtzdGEohnVNow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi, and thanks for your input.

>> I want to be able to query results for each salesman - but new sales
>> personnel are being added and deleted all the time, so a static list
>> is not appropriate.

> OK, we won't blame you.

Phew! :-)

> But since the tables are identical, have you
> considered inheritance?

Ah, therein lies the rub! This system has to work on MS SQL Server
and Oracle - I'll look into this solution there also.

> Create table allsalespersons... to have a master table with the same
> structure as the individual salesperson.

> For existing tables, convert them to child tables:
> alter table fred inherit allsalespersons;
> ...
> For new tables just create them as inherited to begin with.
> Now you can select from "allsalespersons" and get everyone.

It's certainly an elegant solution - I'll just have to see what can be done on
other RDBMSs - thanks again for your input.

Paul...

> Steve

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Wei Shan 2016-03-22 18:38:52 Re: Help with text(decimal) to hex conversion
Previous Message Paul Linehan 2016-03-22 15:09:53 Re: Tricky SQL problem - retrieve information_schema info and make use of it.