pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Tender Wang <tndrwang@gmail.com>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: Guillaume Lelarge <guillaume@lelarge.info>
Subject: Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails
Date: Sat, 26 Oct 2024 21:28:54 +0200
Message-ID: <202410261928.cnrvrjbzx63y@alvherre.pgsql> (raw)
In-Reply-To: <CAHewXN=sHjKSCzvg2AZu=XjMRxjKKG8Mdw7v434xkNtxc05PSA@mail.gmail.com>

On 2024-Oct-25, Tender Wang wrote:

> When I debug codes, I find that the way to access AttrMap almost uses
> "attrmp_ptr->attnums[offset]."
> The codes now usually don't check if the offset is out of bounds, which
> seems unsafe.
> Can we wrap an access function? For example:
> inline AttrNumber(attrmap_ptr, offset)
> {
>   Assert(offset >= 0 && offset < attrmap_ptr->maplen);
>  return attrmap_ptr->attnums[offset];
> }

I don't see any reason not to do this, though it's not directly related
to the bugs in this thread.  I encourage you to submit a patch, opening
a new thread.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/





view thread (70+ messages)  latest in thread

Message-ID: <202410261928.cnrvrjbzx63y@alvherre.pgsql>
Permalink:  ../202410261928.cnrvrjbzx63y@alvherre.pgsql/
Also on:    postgresql.org/message-id/202410261928.cnrvrjbzx63y@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, tndrwang@gmail.com, exclusion@gmail.com, jgdr@dalibo.com, guillaume@lelarge.info
  Subject: Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails
  In-Reply-To: <202410261928.cnrvrjbzx63y@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox