Error code for "no partition or relation found for row" - Mailing list pgsql-admin

From nunks
Subject Error code for "no partition or relation found for row"
Date
Msg-id CACq6szT5+ap5GWWqoM8LTbh4MqT2ABTpXxLswM3KL-N+J5XRkg@mail.gmail.com
Whole thread Raw
Responses Re: Error code for "no partition or relation found for row"
List pgsql-admin
Hi,

What is the error code for capturing "no partition or relation found
for row" errors on PL/pgSQL? I feel there should be a specific error
code for that, but I can't find it in the documentation.

In the past, with function partitioning schemes, I used
"undefined_table" exceptions, but it doesn't work with new Postgres 11
partitioning.

Judging by the executor code in execPartition.c, the error code seems
to be ERRCODE_CHECK_VIOLATION, but listening for "check_violation" on
EXCEPTION blocks doesn't work.

Even if it worked, though, wouldn't it collide with other CHECK
constraint violations? I'm writing a function to create partitions
automatically on insert, and this mixed behavior could trigger an
unwanted "CREATE TABLE ... PARTITION OF ..."


Thanks!
Nunks

----------
“Life beats down and crushes the soul and art reminds you that you have one.”


- Stella Adler


pgsql-admin by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: ALTER PUBLICATION
Next
From: nunks
Date:
Subject: Re: Error code for "no partition or relation found for row"