40{
42 const char *
funcname =
"unique_key_recheck";
52
53
54
55
56
57
60 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
61 errmsg(
"function \"%s\" was not called by trigger manager",
63
67 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
68 errmsg(
"function \"%s\" must be fired AFTER ROW",
70
71
72
73
78 else
79 {
81 (
errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
82 errmsg(
"function \"%s\" must be fired for INSERT or UPDATE",
85 }
86
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 tmptid = checktid;
108 {
110 bool call_again = false;
111
113 &call_again, NULL))
114 {
115
116
117
118
122 }
124 }
125
126
127
128
129
130
134
135
136
137
138
139
140 if (indexInfo->ii_Expressions !=
NIL ||
141 indexInfo->ii_ExclusionOps != NULL)
142 {
145 econtext->ecxt_scantuple = slot;
146 }
147 else
148 estate = NULL;
149
150
151
152
153
154
155
156
157
158
159
161
162
163
164
165 if (indexInfo->ii_ExclusionOps == NULL)
166 {
167
168
169
170
171
172
173
176 false, indexInfo);
177
178
180 }
181 else
182 {
183
184
185
186
187
188
191 estate, false);
192 }
193
194
195
196
197
198 if (estate != NULL)
200
202
204
206}
static Datum values[MAXATTR]
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void check_exclusion_constraint(Relation heap, Relation index, IndexInfo *indexInfo, ItemPointer tupleid, const Datum *values, const bool *isnull, EState *estate, bool newIndex)
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
void FreeExecutorState(EState *estate)
EState * CreateExecutorState(void)
#define GetPerTupleExprContext(estate)
IndexInfo * BuildIndexInfo(Relation index)
void FormIndexDatum(IndexInfo *indexInfo, TupleTableSlot *slot, EState *estate, Datum *values, bool *isnull)
bool index_insert(Relation indexRelation, Datum *values, bool *isnull, ItemPointer heap_t_ctid, Relation heapRelation, IndexUniqueCheck checkUnique, bool indexUnchanged, IndexInfo *indexInfo)
void index_insert_cleanup(Relation indexRelation, IndexInfo *indexInfo)
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
if(TABLE==NULL||TABLE_index==NULL)
static void ItemPointerSetInvalid(ItemPointerData *pointer)
static Datum PointerGetDatum(const void *X)
TupleTableSlot * tg_trigslot
TupleTableSlot * tg_newslot
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
static IndexFetchTableData * table_index_fetch_begin(Relation rel)
static void table_index_fetch_end(struct IndexFetchTableData *scan)
static bool table_index_fetch_tuple(struct IndexFetchTableData *scan, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, bool *call_again, bool *all_dead)
#define CALLED_AS_TRIGGER(fcinfo)
#define TRIGGER_FIRED_FOR_ROW(event)
#define TRIGGER_FIRED_AFTER(event)
#define TRIGGER_FIRED_BY_INSERT(event)
#define TRIGGER_FIRED_BY_UPDATE(event)