From: harukat@sraoss.co.jp
To: pgsql-bugs@postgresql.org
Subject: BUG #11335: an invalid prepare statement causes crash at log_statement = 'mod' or 'ddl'.
Date: Tue, 02 Sep 2014 11:16:53 +0000
Message-ID: <20140902111653.2936.35702@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
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:
<?php
require_once 'MDB2.php';
$con1 =& MDB2::connect("pgsql://postgres@localhost/db1");
if (PEAR::isError($con1)) { die($con1->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.
inline patch 1: ./src/backend/tcop/utility.c.ORG (+0/-2 lines) download inline-1.patch*** ./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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: harukat@sraoss.co.jp
Subject: Re: BUG #11335: an invalid prepare statement causes crash at log_statement = 'mod' or 'ddl'.
In-Reply-To: <20140902111653.2936.35702@wrigleys.postgresql.org>
References: <20140902111653.2936.35702@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox