pgpool2.git / summary / log / commit / refs

commit    ed5a6338cc83fc00ffdac89025eb7a59d6024d4b
Author:   Tatsuo Ishii <ishii at sraoss.co.jp>
Date:     Sun Nov 29 11:56:59 2009 +0000

    Fix is_select_query() not to allow cursor statements.
    Close() should not allowed since hold cursor + update
    may cause data inconsistency.


pool_process_query.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/pool_process_query.c b/pool_process_query.c index d12c462d6..a66724cb0 100644 --- a/pool_process_query.c +++ b/pool_process_query.c @@ -2297,11 +2297,8 @@ int load_balance_enabled(POOL_CONNECTION_POOL *backend, Node* node, char *sql) * returns non 0 if the SQL statement can be load * balanced. Followings are statemnts go into this category. * - * - SELECT without FOR UPDATE/SHARE + * - SELECT/WITH without FOR UPDATE/SHARE * - COPY TO STDOUT - * - DECLARE..SELECT (without INTO nor FOR UPDATE/SHARE) - * - FETCH - * - CLOSE * * note that for SELECT INTO, this function returns 0 */ @@ -2330,27 +2327,17 @@ int is_select_query(Node *node, char *sql) sql++; } - if (IsA(node, SelectStmt) || IsA(node, DeclareCursorStmt)) + if (IsA(node, SelectStmt)) { SelectStmt *select_stmt; - if (IsA(node, SelectStmt)) - select_stmt = (SelectStmt *)node; - else - select_stmt = (SelectStmt *)((DeclareCursorStmt *)node)->query; + select_stmt = (SelectStmt *)node; if (select_stmt->intoClause || select_stmt->lockingClause) return 0; - if (IsA(node, SelectStmt)) - return (*sql == 's' || *sql == 'S' || *sql == '(' || - *sql == 'w' || *sql == 'W' || *sql == 't' || *sql == 'T'); - else - return (*sql == 'd' || *sql == 'D'); - } - else if (IsA(node, FetchStmt) || IsA(node, ClosePortalStmt)) - { - return (*sql == 'f' || *sql == 'F' || *sql == 'c' || *sql == 'C'); + return (*sql == 's' || *sql == 'S' || *sql == '(' || + *sql == 'w' || *sql == 'W' || *sql == 't' || *sql == 'T'); } else if (IsA(node, CopyStmt)) { [parent: b1677e1399f0]