Re: CREATE TABLE creates a composite type corresponding to the table row, which is and is not there

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Hannu Krosing <hannuk(at)google(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: CREATE TABLE creates a composite type corresponding to the table row, which is and is not there
Date: 2024-03-29 03:02:16
Message-ID: 73jtqglviqor5ozqrthjmau7nj4xi7z4obzaqflf7cvliaf4em@4obr7wqlqkye
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024-03-29 02:42 +0100, David G. Johnston wrote:
> For consideration for the doc portion. The existing wording is too
> imprecise for my liking and just tacking on "expects...create type" is
> jarring.
>
> """
> Creates a typed table, which takes it structure from an existing (name
> optionally schema-qualified) stand-alone composite type i.e., one created
> using CREATE TYPE) though it still produces a new composite type as well.
> The table will have a dependency to the referenced type such cascaded alter
> and drop actions on the type will propagate to the table.
>
> A typed table always has the same column names and data types as the type
> it is derived from, and you cannot specify additional columns. But the
> CREATE TABLE command can add defaults and constraints to the table, as well
> as specify storage parameters.
> """

Thanks, that sounds better. I incorporated that with some minor edits
in the attached v3.

> We do use the term "stand-alone composite" in create type so I'm inclined
> to use it instead of "composite created with CREATE TYPE"; especially in
> the error messages; I'm a bit more willing to add the cross-reference to
> create type in the user docs.

Okay, changed in v3 as well. I used "created with CREATE TYPE" in the
error message because I thought it's clearer to the user. But I see no
reason for not using "stand-alone" here as well if it's the established
term.

--
Erik

Attachment Content-Type Size
v3-0001-Document-that-typed-tables-rely-on-CREATE-TYPE.patch text/plain 3.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-03-29 03:07:42 Re: AIX support
Previous Message Thomas Munro 2024-03-29 03:00:22 Re: AIX support