On 8/2/17 13:28, Alvaro Herrera wrote: > I think pg_class is a reasonable place to put more generic relkind lists > alongside a matching error message for each, rather than specialized > "does this relkind have storage" macros. What about something like a > struct list in pg_class.h, > > { > { > relkinds_r_i_T, > { 'r', 'i', 'T' }, > gettext_noop("relation %s is not a table, index or toast table") > }, > ... > }
I don't find this style of error message optimal anyway. If I do, for example ALTER TABLE someview ADD CONSTRAINT ... ERROR: "someview" is not a table, foreign table, whatever then this information is not helpful. It's not like I'm going to turn my view into a foreign table in order to be able to proceed with that command. The actual error, from the perspective of the user, is something like ERROR: "someview" is a view DETAIL: Views cannot have constraints. (Maybe they can. This is an example.) -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers