On 2019-02-26 06:30, Michael Paquier wrote: > + if (attgenerated) > + { > + /* > + * Generated column: Dropping anything that the generation expression > + * refers to automatically drops the generated column. > + */ > + recordDependencyOnSingleRelExpr(&colobject, expr, > RelationGetRelid(rel), > + DEPENDENCY_AUTO, > + DEPENDENCY_AUTO, false); > + } > A CCI is not necessary I think here, still the recent thread about > automatic dependencies with identity columns had a much similar > pattern...
Yeah, worth taking another look. > > + else if (generated[0] == ATTRIBUTE_GENERATED_VIRTUAL) > + default_str = psprintf("generated always as (%s)", > PQgetvalue(res, i, attrdef_col)); > Nit: I would add VIRTUAL instead of relying on the default option. I suppose we'll decide that when the virtual columns are actually added. I see your point. > Another thing I was thinking about: could it be possible to add a > sanity check in sanity_check.sql so as a column more that one > field in attidentity, attgenerated and atthasdef set at the same time? There is something like that at the top of src/test/regress/sql/generated.sql. I can expand that. But it only covers the tests. For run time checks, you'd want something like pg_catcheck. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services