aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/tupdesc.h
blob: a26bbc704da946ff5a6466f6f9d853130749d7e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*-------------------------------------------------------------------------
 *
 * tupdesc.h--
 *    POSTGRES tuple descriptor definitions.
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
 * $Id: tupdesc.h,v 1.1.1.1 1996/07/09 06:21:09 scrappy Exp $
 *
 *-------------------------------------------------------------------------
 */
#ifndef	TUPDESC_H
#define TUPDESC_H

#include "postgres.h"
#include "access/attnum.h"
#include "nodes/pg_list.h"	/* for List */
#include "catalog/pg_attribute.h"

/*
 * a TupleDesc is an array of AttributeTupleForms, each of which is a
 * pointer to a AttributeTupleForm
 */
/* typedef AttributeTupleForm      *TupleDesc; */

/* a TupleDesc is a pointer to a structure which includes an array of */
/* AttributeTupleForms, i.e. pg_attribute information, and the size of */
/* the array, i.e. the number of attributes */
/* in short, a TupleDesc completely captures the attribute information */
/* for a tuple */

typedef struct tupleDesc {
    int  natts;
    AttributeTupleForm *attrs;
} *TupleDesc;

extern TupleDesc CreateTemplateTupleDesc(int natts);

extern TupleDesc CreateTupleDesc(int natts, AttributeTupleForm *attrs);

extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc);

extern bool TupleDescInitEntry(TupleDesc desc,
			       AttrNumber attributeNumber,
			       char *attributeName, 
			       char *typeName, 
			       int attdim, 
			       bool attisset);

extern TupleDesc BuildDescForRelation(List *schema, char *relname);

#endif	/* TUPDESC_H */