Re: An INSERT can kill the PostgreSQL server

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richi Plana <richip(at)mozcom(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: An INSERT can kill the PostgreSQL server
Date: 2000-05-28 17:47:10
Message-ID: 11859.959536030@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Richi Plana <richip(at)mozcom(dot)com> writes:
> create table devices (brand varchar(30), model varchar(30), serial
> varchar(30), ro_community varchar(50)[], rw_community varchar(50)[], primary
> key (brand, model, serial));

> create table routers (lo_address inet) inherits (devices);

> insert into routers values ('Cisco', '7206VXR', '72498595', '{"Butterflies",
> "Intehsoijfeijfjf"}', NULL, '10.2.3.4');

Ah, I see it: it's the NULL array value that is causing the problem.
6.5 parser didn't really handle the NULL properly, but 7.0's does:
it tries to apply array_map() to the NULL to ensure it's coerced to
50-chars-per-item length limit. Which means array_map had better be
NULL-proof.

This patch is applied for 7.0.1, but if you need a fix now:

*** src/backend/utils/adt/arrayfuncs.c~ Wed Jan 26 00:57:12 2000
--- src/backend/utils/adt/arrayfuncs.c Sun May 28 13:43:34 2000
***************
*** 1308,1313 ****
--- 1308,1317 ----
char *s;
char *p;
va_list ap;
+
+ /* Need to guard against NULL input array */
+ if (v == NULL)
+ return NULL;

/* Large objects not yet supported */
if (ARR_IS_LO(v) == true)

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2000-05-29 03:49:23 Re: Postgresql 7.0 bug
Previous Message Tom Lane 2000-05-28 17:25:28 Re: An INSERT can kill the PostgreSQL server