Re: Adding type info etc for inheritance errmsg: "child table is missing column ..."

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ryan Murphy <ryanfmurphy(at)gmail(dot)com>
Cc: PostgreSQL DEV mailing list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding type info etc for inheritance errmsg: "child table is missing column ..."
Date: 2017-01-07 19:15:18
Message-ID: 7663.1483816518@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ryan Murphy <ryanfmurphy(at)gmail(dot)com> writes:
> So I tried using format_type_with_typemod() thinking that the "typemod
> info" meant things like NOT NULL, DEFAULT etc.

No, it means atttypmod, which stores info like the max length for
varchar(n).

> when I was hoping for
> user=# alter table temp inherit entity;
> ERROR: child table is missing column "id" uuid default uuid_generate_v1mc()
> Is there an easy way to get the string that includes all those additional
> constraints/defaults etc?

No, and TBH I would vote strongly against including that much detail in
this error message anyway. That info could be indefinitely long, and it's
not especially relevant to the stated error condition --- for example, the
presence of a default is *not* relevant to whether the column matches the
parent. I'm okay with shoehorning column type into this message, but not
much more than that.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ryan Murphy 2017-01-07 19:16:55 Re: Adding type info etc for inheritance errmsg: "child table is missing column ..."
Previous Message Ryan Murphy 2017-01-07 19:00:43 Re: Adding type info etc for inheritance errmsg: "child table is missing column ..."