Re: [HACKERS] Adding type info etc for inheritance errmsg: "childtable is missing column ..." - Mailing list pgsql-hackers

From Ryan Murphy
Subject Re: [HACKERS] Adding type info etc for inheritance errmsg: "childtable is missing column ..."
Date
Msg-id CAHeEsBfvykrNeengd95kNX5oDUYVjDjfTcMLCApM-tOp1vd6mA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Adding type info etc for inheritance errmsg: "childtable is missing column ..."  (Ryan Murphy <ryanfmurphy@gmail.com>)
Responses Re: [HACKERS] Adding type info etc for inheritance errmsg: "child table is missing column ..."  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Replication/backup defaults
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Adding type info etc for inheritance errmsg: "child table is missing column ..."