Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XOm5G-00067K-FY for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Sep 2014 11:17:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XOm5F-00005S-1p for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Sep 2014 11:17:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XOm5E-00005H-4v for pgsql-bugs@postgresql.org; Tue, 02 Sep 2014 11:17:08 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XOm58-0003cA-Ev for pgsql-bugs@postgresql.org; Tue, 02 Sep 2014 11:17:07 +0000 MIME-Version: 1.0 Subject: BUG #11335: an invalid prepare statement causes crash at log_statement = 'mod' or 'ddl'. To: pgsql-bugs@postgresql.org From: harukat@sraoss.co.jp Date: Tue, 02 Sep 2014 11:16:53 +0000 Message-ID: <20140902111653.2936.35702@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 11335 Logged by: invalid prepare statement causes crash at log_statement = 'mod' or 'ddl'. Email address: harukat@sraoss.co.jp PostgreSQL version: 9.3.5 Operating system: CentOS 6.2 (64bit / gcc 4.4.7) Description: setting: log_statement = 'mod' # or 'ddl' reproduction client code: getMessage()); } $sth = $con1->prepare(""); if (PEAR::isError($sth)) { die($sth->getMessage()); } $sth->execute(); ?> log messages: 2014-09-02 19:41:57 JST 9453 LOG: server process (PID 10372) was terminated by signal11: Segmentation fault 2014-09-02 19:41:57 JST 9453 DETAIL: Failed process was running: EXECUTE mdb2_statement_pgsql_9cc7dc53dfc30b3c2b937c650346f586 This occur in 9.3.5 and 9.1.14. (It probably occur at any versions.) I tested that the following fix prevent this crash. *** ./src/backend/tcop/utility.c 2014-09-02 19:32:44.735266203 +0900 --- ./src/backend/tcop/utility.c.ORG 2014-09-02 18:17:47.631854101 +0900 *************** *** 2307,2314 **** GetCommandLogLevel(Node *parsetree) { LogStmtLevel lev; - if (! parsetree) - return LOGSTMT_ALL; switch (nodeTag(parsetree)) { --- 2307,2312 ---- Though we should throw ERROR for empty prepared statement, I hope for a symptomatic treatment such as the above. Because an application package use such wrong query. ---------------------------------------------------------- Haruka Takatsuka harukat@sraoss.co.jp SRA OSS, Inc. http://www.sraoss.co.jp -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs