pgpool2.git / summary / log / commit / refs

commit    0db3392b4c87ed9c8e2ce921d713767b3886546b
Author:   Tatsuo Ishii <ishii at sraoss.co.jp>
Date:     Sat May 02 08:48:46 2009 +0000

    Fix is_select_query() to test "sql" parameter is NULL.  As of 2.2,
    pgpool sets Portal->sql_string to NULL for SQL command PREPARE.
    Usually this is ok, since in most cases SQL command EXECUTE follows
    anyway. Problem is, some applications mix PREPARE with extended
    protocol command "EXECUTE" and so on. Execute() seems to think this
    never happens but it is not real. Someday we should extract actual
    query string from PrepareStmt->query and set it to Portal->sql_string.


pool_process_query.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pool_process_query.c b/pool_process_query.c index 3258cf45e..b41764d83 100644 --- a/pool_process_query.c +++ b/pool_process_query.c @@ -2104,6 +2104,19 @@ int is_select_query(Node *node, char *sql) if (node == NULL) return 0; + /* + * 2009/5/1 Tatsuo says: This test is not bogus. As of 2.2, pgpool + * sets Portal->sql_string to NULL for SQL command PREPARE. + * Usually this is ok, since in most cases SQL command EXECUTE + * follows anyway. Problem is, some applications mix PREPARE with + * extended protocol command "EXECUTE" and so on. Execute() seems + * to think this never happens but it is not real. Someday we + * should extract actual query string from PrepareStmt->query and + * set it to Portal->sql_string. + */ + if (sql == NULL) + return 0; + if (pool_config->ignore_leading_white_space) { /* ignore leading white spaces */ [parent: 4c5c2b57f86c]