1 /* -*-pgsql-c-*- */ 2 /* 3 * 4 * $Header$ 5 * 6 * pgpool: a language independent connection pool server for PostgreSQL 7 * written by Tatsuo Ishii 8 * 9 * Copyright (c) 2003-2012 PgPool Global Development Group 10 * 11 * Permission to use, copy, modify, and distribute this software and 12 * its documentation for any purpose and without fee is hereby 13 * granted, provided that the above copyright notice appear in all 14 * copies and that both that copyright notice and this permission 15 * notice appear in supporting documentation, and that the name of the 16 * author not be used in advertising or publicity pertaining to 17 * distribution of the software without specific, written prior 18 * permission. The author makes no representations about the 19 * suitability of this software for any purpose. It is provided "as 20 * is" without express or implied warranty. 21 * 22 * pool_select_walker.h.: Walker functions for SELECT 23 * 24 */ 25 26 #ifndef POOL_SELECT_WALKER_H 27 #define POOL_SELECT_WALKER_H 28 29 #include "pool.h" 30 #include "parser/nodes.h" 31 #include "parser/primnodes.h" 32 #include "parser/makefuncs.h" 33 34 #define POOL_MAX_SELECT_OIDS 128 35 #define POOL_NAMEDATALEN 64 /* from NAMEDATALEN of PostgreSQL */ 36 37 typedef struct { 38 bool has_system_catalog; /* True if system catalog table is used */ 39 bool has_temp_table; /* True if temporary table is used */ 40 bool has_unlogged_table; /* True if unlogged table is used */ 41 bool has_view; /* True if view is used */ 42 bool has_function_call; /* True if write function call is used */ 43 int pg_terminate_backend_pid; /* pid argument of pg_terminate_backedn_call(if used) */ 44 bool has_non_immutable_function_call; /* True if non immutable functions are used */ 45 bool has_insertinto_or_locking_clause; /* True if it has SELECT INTO or FOR SHARE/UPDATE */ 46 int num_oids; /* number of oids */ 47 int table_oids[POOL_MAX_SELECT_OIDS]; /* table oids */ 48 char table_names[POOL_MAX_SELECT_OIDS][POOL_NAMEDATALEN]; /* table names */ 49 } SelectContext; 50 51 extern int pool_get_terminate_backend_pid(Node *node); 52 extern bool pool_has_function_call(Node *node); 53 extern bool pool_has_non_immutable_function_call(Node *node); 54 extern bool pool_has_system_catalog(Node *node); 55 extern bool pool_has_temp_table(Node *node); 56 extern void discard_temp_table_relcache(void); 57 extern bool pool_has_unlogged_table(Node *node); 58 extern bool pool_has_view(Node *node); 59 extern bool pool_has_insertinto_or_locking_clause(Node *node); 60 extern bool pool_has_pgpool_regclass(void); 61 extern bool pool_has_to_regclass(void); 62 extern bool raw_expression_tree_walker(Node *node, bool (*walker) (), void *context); 63 extern int pool_table_name_to_oid(char *table_name); 64 extern int pool_extract_table_oids_from_select_stmt(Node *node, SelectContext *ctx); 65 extern RangeVar *makeRangeVarFromNameList(List *names); 66 extern char *make_table_name_from_rangevar(RangeVar *rangevar); 67 extern int pattern_compare(char *str, const int type, const char *param_name); 68 extern bool is_unlogged_table(char *table_name); 69 extern bool is_view(char *table_name); 70 71 #endif /* POOL_SELECT_WALKER_H */ 72