Re: What's the benefit (or usage scenario) of a "typed table"?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: What's the benefit (or usage scenario) of a "typed table"?
Date: 2016-12-31 15:51:01
Message-ID: CAKFQuwb8K4ZRwO_ooY2b4U8yAQmfcLX3TEeNfoMKRJqEHYdvow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Saturday, December 31, 2016, Thomas Kellerer <spam_eater(at)gmx(dot)net> wrote:

> I recently stumbled over "typed tables" in Postgres
> (there were several questions containing this on stackoverflow recently)
>
> create type some_type as (id integer, data text);
> create table some_table of some_type;
>
> I wonder what the benefit of a typed table is and when this would be
> useful?
>

Given that I'd frown upon having two types with identical structure I'd say
this is could be harmfull if swallowed. Thoguh it might find use in
refactoring and maintaining backward compatibility. It does setup an
object dependency which is the only visible difference from just copy the
type definition into the CREATE TABLE. But I'd say if you want a table
with said structure you should plan on droppign the original type after
you've altered all references to it to point to the new implicit type
created with the table.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2016-12-31 16:25:54 Re: What's the benefit (or usage scenario) of a "typed table"?
Previous Message Thomas Kellerer 2016-12-31 15:34:56 What's the benefit (or usage scenario) of a "typed table"?