[PATCH] Add schema and table names to partition error

From: Chris Bandy <bandy(dot)chris(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] Add schema and table names to partition error
Date: 2020-02-29 19:33:48
Message-ID: 0aa113a3-3c7f-db48-bcd8-f9290b2269ae@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
0001-Add-schema-and-table-names-to-partition-error.patch text/x-patch 1.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2020-02-29 19:35:53 Re: Broken resetting of subplan hash tables
Previous Message Tom Lane 2020-02-29 19:05:51 Re: subplan resets wrong hashtable