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

From: Ryan Murphy <ryanfmurphy(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:00:43
Message-ID: CAHeEsBfvykrNeengd95kNX5oDUYVjDjfTcMLCApM-tOp1vd6mA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Thanks Tom, I'll redo the patch using one of those, and get back to you
> guys.
>
>
So I tried using format_type_with_typemod() thinking that the "typemod
info" meant things like NOT NULL, DEFAULT etc. It builds and includes the
plain type but not all that stuff. E.g.

user=# alter table temp inherit entity;
ERROR: child table is missing column "id" uuid

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? I noticed that defaults seem to be stored in the
Form_pg_attrdef struct defined in src/include/catalog/pg_attrdef.h, and
haven't yet seen how constraints like NOT NULL are handled.

Thanks,
Ryan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-01-07 19:15:18 Re: Adding type info etc for inheritance errmsg: "child table is missing column ..."
Previous Message Peter Eisentraut 2017-01-07 18:57:37 Re: Replication/backup defaults