I wonder if we shouldn't be using errtablecol() here instead of (in addition to?) patching the errmsg() to include the table name.
Discussion: If we really like having the table names in errtable(), then we should have psql display it by default, and other tools will follow suit; in that case we should remove the table name from error messages, or at least not add it to even more messages. If we instead think that errtable() is there just for programmatically knowing the affected table, then we should add the table name to all errmsg() where relevant, as in the patch under discussion. What do others think? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services