From: | Hamid Akhtar <hamid(dot)akhtar(at)gmail(dot)com> |
---|---|
To: | grumpylittleted(at)googlemail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #16909: On update (not insert) the attisdropped flag is set for tables which are recreated with the same col |
Date: | 2021-03-02 14:16:35 |
Message-ID: | CANugjhvSqqEq8dJ-qrDiwPYQBoXc1FuMx4S5NcFd4Zp8VEtFJQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Can you please share the complete output?
Seems like a false alarm per my testing.
On Tue, Mar 2, 2021 at 3:58 PM PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:
> The following bug has been logged on the website:
>
> Bug reference: 16909
> Logged by: Grumpylittleted
> Email address: grumpylittleted(at)googlemail(dot)com
> PostgreSQL version: 13.2
> Operating system: Linux 5.8.0-44-generic #50~20.04.1-Ubuntu S
> Description:
>
> /*
>
> BUG:
>
> Using 13.2
> On update (not insert) the attisdropped flag is set for tables which are
> recreated with the same column names as the original but where preceding
> columns have been dropped
>
> METHOD:
> Create a table t with more than two columns: x, y, z
> Drop that table
> Create a table t with a subset of the columns with the same name as the
> previous table: here we remove y
> Insert a new row: there are two attributes (correct), neither of which
> have the attisdropped flag set (correct) (so bug not apparent with
> inserts)
> Update the row: there are two attributes (correct), the first attribute
> has the attisdropped flag unset (correct) BUT the second attribute has the
> attisdropped flag set (incorrect)
>
>
>
> make
> sudo cp ./f.so `pg_config --pkglibdir`
>
>
> SQL:
>
> create or replace function f() returns trigger as './f.so','f' language c
> strict;
>
> drop table if exists t cascade;
> create table t(x int, y int, z int);
>
> drop table t cascade;
> create table t(x int, z int);
> create trigger tf before insert or update on t for each row execute
> procedure f();
> insert into t values(4,5); -- attr num=1 attisdropped=0
> update t set x=2;
>
>
>
>
> */
>
> #include <stdlib.h>
> #include <stdio.h>
> #include <limits.h>
> #include "postgres.h"
> #include "fmgr.h"
> #include "executor/spi.h"
> #include "commands/trigger.h"
> #include "utils/rel.h"
> #include "utils/fmgrprotos.h"
>
>
>
> PG_MODULE_MAGIC;
> PG_FUNCTION_INFO_V1( f );
> Datum f( PG_FUNCTION_ARGS ) {
>
> TriggerData *trigdata = ( TriggerData * ) fcinfo->context;
> const TupleDesc tupdesc = trigdata->tg_relation->rd_att;
> HeapTuple tuple = TRIGGER_FIRED_BY_UPDATE( trigdata->tg_event ) ?
> trigdata->tg_newtuple : trigdata->tg_trigtuple;
>
> for( int i = 1; i <= tupdesc->natts; i++ ) {
> elog( INFO, "attr num=%d attisdropped=%d", i, TupleDescAttr( tupdesc, i
> )->attisdropped );
> }
>
> return PointerGetDatum( tuple );
>
> }
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-03-02 15:40:19 | Re: BUG #16909: On update (not insert) the attisdropped flag is set for tables which are recreated with the same col |
Previous Message | Michał Albrycht | 2021-03-02 14:12:00 | Re: BUG #16855: No partition pruning when using partitions with custom hash function |