[PATCH] Add schema and table names to partition error - Mailing list pgsql-hackers

From Chris Bandy
Subject [PATCH] Add schema and table names to partition error
Date
Msg-id 0aa113a3-3c7f-db48-bcd8-f9290b2269ae@gmail.com
Whole thread Raw
Responses Re: [PATCH] Add schema and table names to partition error  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-hackers
Hello,

I'm writing telemetry data into a table partitioned by time. When there 
is no partition for a particular date, my app notices the constraint 
violation, creates the partition, and retries the insert.

I'm used to handling constraint violations by observing the constraint 
name in the error fields. However, this error had none. I set out to add 
the name to the error field, but after a bit of reading my impression is 
that partition constraints are more like a property of a table.

I've attached a patch that adds the schema and table name fields to 
errors for my use case:

- Insert data into a partitioned table for which there is no partition.
- Insert data directly into an incorrect partition.

Thanks,
Chris

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: subplan resets wrong hashtable
Next
From: Andres Freund
Date:
Subject: Re: Broken resetting of subplan hash tables