Re: BUG #19352: SQL Error messages do not include schema name along with table or data object name.
| От | Álvaro Herrera |
|---|---|
| Тема | Re: BUG #19352: SQL Error messages do not include schema name along with table or data object name. |
| Дата | |
| Msg-id | 202512121504.x4f5zza4r47m@alvherre.pgsql обсуждение исходный текст |
| Ответ на | Re: BUG #19352: SQL Error messages do not include schema name along with table or data object name. (Kirill Reshke <reshkekirill@gmail.com>) |
| Список | pgsql-bugs |
Actually, these error reports do include a schema name among other things -- it's just hidden from view. For psql it's very easy to make them visible, just use \set VERBOSITY verbose Then the error message includes more detail: =# insert into sh.t2 values (1); ERROR: 23503: insert or update on table "t2" violates foreign key constraint "t2_i_fkey" DETAIL: Key (i)=(1) is not present in table "t". SCHEMA NAME: sh TABLE NAME: t2 CONSTRAINT NAME: t2_i_fkey LOCATION: ri_ReportViolation, ri_triggers.c:2770 Other clients would have their own ways to display that information. Kirill Reshke wrote: > I may be foolish but constraints are not schema-qualified, they just > have names. You're not foolish, but the schema name is attached to the table. You're correct that there can be more than one constraint with the same name in a schema, but there cannot be more than one constraint with the same name on the _table_, which is itself uniquely identified by the schema and its name. So you could argue that we could improve this by schema-qualifying the table name (not the constraint name) in this message: ERROR: 23503: insert or update on table "sh.t2" violates foreign key constraint "t2_i_fkey" -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "No me acuerdo, pero no es cierto. No es cierto, y si fuera cierto, no me acuerdo." (Augusto Pinochet a una corte de justicia)
В списке pgsql-bugs по дате отправления: