Peter Eisentraut wrote: > 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.
Hmm, this is a good point ... not against my proposal, but rather against the current coding. I agree it could be more user-friendly. > The actual error, from the perspective of the user, is something like > > ERROR: "someview" is a view > DETAIL: Views cannot have constraints. OK. "%s is a %s" is a reasonable set of errors -- we just need one for each relkind. So the first one is easy. But the second one is not easy, because we'd need one message per relkind per operation kind. We cannot possibly write/translate that many messages. If we make the relkind generic in the errdetail message, maybe it can work; something like "Relations of that type cannot have constraints" would work, for example. Or "Relations of type "view" cannot have constraints", although this reads very strangely. Maybe someone has a better idea? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers