1 #ifndef __QUERY_UTIL_H__
2 #define __QUERY_UTIL_H__
5 #include "utils/memutils.h"
8 #include "executor/spi.h"
17 struct QTNode **child;
20 #define QTN_NEEDFREE 0x01
21 #define QTN_NOCHANGE 0x02
22 #define QTN_WORDFREE 0x04
31 QTNode *QT2QTN(ITEM * in, char *operand);
32 QUERYTYPE *QTN2QT(QTNode * in, MemoryType memtype);
33 void QTNFree(QTNode * in);
34 void QTNSort(QTNode * in);
35 void QTNTernary(QTNode * in);
36 void QTNBinary(QTNode * in);
37 int QTNodeCompare(QTNode * an, QTNode * bn);
38 QTNode *QTNCopy(QTNode * in, MemoryType memtype);
39 bool QTNEq(QTNode * a, QTNode * b);
42 extern MemoryContext AggregateContext;
44 #define MEMALLOC(us, s) ( ((us)==SPIMemory) ? SPI_palloc(s) : ( ( (us)==PlainMemory ) ? palloc(s) : MemoryContextAlloc(AggregateContext, (s)) ) )
45 #define MEMFREE(us, p) ( ((us)==SPIMemory) ? SPI_pfree(p) : pfree(p) )