Skip to content

Commit 9dbfcc2

Browse files
committed
Fix some problems with dropped columns in pltcl functions.
1 parent 6d239ee commit 9dbfcc2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/pl/tcl/pltcl.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ENHANCEMENTS, OR MODIFICATIONS.
3232
*
3333
* IDENTIFICATION
34-
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.76 2003/08/08 21:42:59 momjian Exp $
34+
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.77 2003/09/04 15:10:10 tgl Exp $
3535
*
3636
**********************************************************************/
3737

@@ -694,6 +694,7 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
694694
pfree(stroid);
695695

696696
/* A list of attribute names for argument TG_relatts */
697+
/* note: we deliberately include dropped atts here */
697698
Tcl_DStringAppendElement(&tcl_trigtup, "");
698699
for (i = 0; i < tupdesc->natts; i++)
699700
Tcl_DStringAppendElement(&tcl_trigtup,
@@ -863,9 +864,8 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
863864
modvalues[i] = (Datum) NULL;
864865
}
865866

866-
modnulls = palloc(tupdesc->natts + 1);
867+
modnulls = palloc(tupdesc->natts);
867868
memset(modnulls, 'n', tupdesc->natts);
868-
modnulls[tupdesc->natts] = '\0';
869869

870870
/************************************************************
871871
* Care for possible elog(ERROR)'s below
@@ -2312,6 +2312,10 @@ pltcl_set_tuple_values(Tcl_Interp *interp, CONST84 char *arrayname,
23122312

23132313
for (i = 0; i < tupdesc->natts; i++)
23142314
{
2315+
/* ignore dropped attributes */
2316+
if (tupdesc->attrs[i]->attisdropped)
2317+
continue;
2318+
23152319
/************************************************************
23162320
* Get the attribute name
23172321
************************************************************/
@@ -2382,6 +2386,10 @@ pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
23822386

23832387
for (i = 0; i < tupdesc->natts; i++)
23842388
{
2389+
/* ignore dropped attributes */
2390+
if (tupdesc->attrs[i]->attisdropped)
2391+
continue;
2392+
23852393
/************************************************************
23862394
* Get the attribute name
23872395
************************************************************/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy