reltime with NULL fields crashes backend - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject reltime with NULL fields crashes backend
Date
Msg-id 200104111138.f3BBc4p06732@hub.org
Whole thread Raw
List pgsql-bugs
Dmitry Tsitelov (cit@tag-ltd.spb.ru) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
reltime with NULL fields crashes backend

Long Description
I use expression like int4(reltime(<interval-field>)) to get interval length in seconds. When <interval-field> is NULL
backendcrashes (psql session): 

organizer=> SELECT reltime(task.duration_real) FROM pmgr_task task WHERE task.id = 5;
pqReadData() -- backend closed the channel unexpectedly.
This probably means the backend terminated abnormally before or while processing the request.

#######
OS: FreeBSD 4.1-RELEASE #2
PostgreSQL ver: PostgreSQL 7.0.2 on i386-unknown-freebsdelf4.1, compiled by gcc 2.95.2

####### Postmaster log:

Server process (pid 37685) exited with status 139 at Wed Apr 11 15:33:18 2001
Terminating any active server processes...
NOTICE:  Message from PostgreSQL backend:
        The Postmaster has informed me that some other backend died abnormally a
nd possibly corrupted shared memory.
        I have rolled back the current transaction and am going to terminate you
r database system connection and exit.
        Please reconnect to the database system and repeat your query.
NOTICE:  Message from PostgreSQL backend:
        The Postmaster has informed me that some other backend died abnormally a
nd possibly corrupted shared memory.
        I have rolled back the current transaction and am going to terminate you
r database system connection and exit.
        Please reconnect to the database system and repeat your query.
NOTICE:  Message from PostgreSQL backend:
        The Postmaster has informed me that some other backend died abnormally a
nd possibly corrupted shared memory.
        I have rolled back the current transaction and am going to terminate you
r database system connection and exit.
        Please reconnect to the database system and repeat your query.
Server processes were terminated at Wed Apr 11 15:33:18 2001
Reinitializing shared memory and semaphores
DEBUG:  Data Base System is starting up at Wed Apr 11 15:33:18 2001
The Data Base System is starting up
DEBUG:  Data Base System was interrupted being in production at Wed Apr 11 15:27
:41 2001
DEBUG:  Data Base System is in production state at Wed Apr 11 15:33:18 2001




Sample Code
CREATE TABLE t ( f interval );         : OK
INSERT INTO t (f) VALUES ('23 s');     : OK
SELECT reltime(f) FROM t;        : OK
SELECT int4(reltime(f)) FROM t;        : OK
DELETE FROM t;                    : OK
INSERT INTO t (f) VALUES (NULL);        : OK
SELECT reltime(f) FROM t;        : Backend crash

SELECT reltime(NULL);                   : OK
SELECT reltime(interval(NULL));         : Backend crash


No file was uploaded with this report

pgsql-bugs by date:

Previous
From: "Rainer Mager"
Date:
Subject: RE: Problem with 7.0.3 dump -> 7.1b4 restore
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: result of conversion to timestamp is shifted 1 minute back