The content of the column_name field in the error response for a constraint violation

From: arkhipov(dot)nr(at)gmail(dot)com
To: pgsql-hackers(at)postgresql(dot)org
Subject: The content of the column_name field in the error response for a constraint violation
Date: 2024-06-09 11:04:11
Message-ID: 3c215aef-9a5c-4eb0-9a30-3cd06a5e5ba5@Spark
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed that the error response for a constraint violation only contains the column name for not-null constraints. I'm confused because the field isn't present when other types of constraints are triggered, such as unique, foreign keys, and check constraints. Was this done intentionally because these other constraints may involve multiple columns, while the column_name field expects a single column?

I understand that a client can find out which columns are involved by a constraint name. Alternatively, should it be made more handy so that the column_name field is present for all constraints and includes all involved columns?

С уважением,
Архипов Никита

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nitin Jadhav 2024-06-09 15:05:08 Re: Show WAL write and fsync stats in pg_stat_io
Previous Message cca5507 2024-06-09 09:39:25 Format the code in xact_decode