1 /*-------------------------------------------------------------------------
4 * Definitions for PostgreSQL attribute mappings
7 * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/access/attmap.h
12 *-------------------------------------------------------------------------
17 #include "access/attnum.h"
18 #include "access/tupdesc.h"
21 * Attribute mapping structure
23 * This maps attribute numbers between a pair of relations, designated
24 * 'input' and 'output' (most typically inheritance parent and child
25 * relations), whose common columns may have different attribute numbers.
26 * Such difference may arise due to the columns being ordered differently
27 * in the two relations or the two relations having dropped columns at
28 * different positions.
30 * 'maplen' is set to the number of attributes of the 'output' relation,
31 * taking into account any of its dropped attributes, with the corresponding
32 * elements of the 'attnums' array set to 0.
34 typedef struct AttrMap
40 extern AttrMap
*make_attrmap(int maplen
);
41 extern void free_attrmap(AttrMap
*map
);
43 /* Conversion routines to build mappings */
44 extern AttrMap
*build_attrmap_by_name(TupleDesc indesc
,
46 extern AttrMap
*build_attrmap_by_name_if_req(TupleDesc indesc
,
48 extern AttrMap
*build_attrmap_by_position(TupleDesc indesc
,