Re: PostgreSQL Inheritance and column mapping

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: PostgreSQL Inheritance and column mapping
Дата
Msg-id 542E0FDE.5020703@BlueTreble.com
обсуждение исходный текст
Ответ на Re: PostgreSQL Inheritance and column mapping  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: PostgreSQL Inheritance and column mapping  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
Список pgsql-general
On 10/2/14, 9:00 AM, Tom Lane wrote:
> Achilleas Mantzios <achill@matrix.gatewaynet.com> writes:
>> Was there ever any discussion.thought about being able to follow a non-strict by name
>> column mapping between inherited tables and father tables?
> No.  You could use a view with UNION ALL perhaps.
FWIW, I've had some less than stellar results with that (admittedly, back on 8.4).

The other thing you could do is something like:

ALTER TABLE invoice_document RENAME TO invoice_document_raw;
ALTER TABLE invoice_document_raw RENAME invoice_no TO doc_no;
CREATE VIEW invoice_document AS
     SELECT ...
         , doc_no AS invoice_no
         , ...
     FROM invoice_document_raw
;

If you make that view writable then no one needs to know that you renamed the column in the underlying table.


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

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: How to find greatest record before known values fast
Следующее
От: David G Johnston
Дата:
Сообщение: Re: How to find greatest record before known values fast