Alvaro Herrera <alvhe...@2ndquadrant.com> writes:
> Peter Eisentraut wrote:
>> 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?

I think Peter's got the error and the detail backwards.  It should be
more like

ERROR: "someview" cannot have constraints
DETAIL: "someview" is a view.

If we do it like that, we need one ERROR message per error reason,
and one DETAIL per relkind, which should be manageable.

A more verbose approach is

ERROR: "someview" cannot have constraints
DETAIL: "someview" is a view, which is not a supported kind of relation
for this purpose.

                        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to