From: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
---|---|
To: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, Alexander Lakhin <exclusion(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: partitioning and identity column |
Date: | 2024-05-06 14:01:33 |
Message-ID: | 20240506140133.ctydnsfo66pchj5r@ddolgov.remote.csb |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On Mon, May 06, 2024 at 06:52:41PM +0530, Ashutosh Bapat wrote:
> On Sun, May 5, 2024 at 1:43 AM Dmitry Dolgov <9erthalion6(at)gmail(dot)com> wrote:
> > I had a quick look, it covers the issues mentioned above in the thread.
> > Few nitpicks/questions:
> >
> > * I think it makes sense to verify if the ptup is valid. This approach
> > would fail if the target column of the root partition is marked as
> > attisdropped.
> >
>
> The column is searched by name which is derived from attno of child
> partition. So it has to exist in the root partition. If it doesn't
> something is seriously wrong. Do you have a reproducer? We may want to add
> Assert(HeapTupleIsValid(ptup)) just in case. But it seems unnecessary to me.
Sure, normally it should work. I don't have any particular situation in
mind, when attisdropped might be set on a root partition, but obviously
setting it manually crashes this path. Consider it mostly as suggestion
for a more defensive implementation "just in case".
> > Oid
> > -getIdentitySequence(Oid relid, AttrNumber attnum, bool missing_ok)
> > +getIdentitySequence(Relation rel, AttrNumber attnum, bool missing_ok)
> > {
> >
> > [...]
> >
> > + relid = llast_oid(ancestors);
> > + ptup = SearchSysCacheAttName(relid, attname);
> > + attnum = ((Form_pg_attribute) GETSTRUCT(ptup))->attnum;
> >
> > * getIdentitySequence is used in build_column_default, which in turn
> > often appears in loops over table attributes. AFAICT it means that the
> > same root partition search will be repeated multiple times in such
> > situations if there is more than one identity. I assume the
> > performance impact of this repetition is negligible?
> >
>
> I thought having multiple identity columns would be rare and hence avoided
> making code complex. Otherwise we have to get root partition somewhere in
> the caller hierarchy separately the logic much farther apart. Usually the
> ancestor entries will be somewhere in the cache
Yeah, agree, it's reasonable to expect that the case with multiple
identity columns will be rare.
From | Date | Subject | |
---|---|---|---|
Next Message | Justin Pryzby | 2024-05-06 14:05:38 | backend stuck in DataFileExtend |
Previous Message | Robert Haas | 2024-05-06 13:39:38 | Re: On disable_cost |