Skip site navigation (1) Skip section navigation (2)

Re: BUG #1723: array_cat() bug when passed empty array

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dave Chapeskie" <pgsql(at)ddm(dot)wox(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1723: array_cat() bug when passed empty array
Date: 2005-06-20 19:44:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
I wrote:
> Actually, I would say the bug is exec_assign_value's.  There is nothing
> at all wrong with a function returning one of its input values; for
> example the smaller/larger functions all do that.

For that matter, you don't need a function at all:

regression=# create or replace function copyit(text) returns text as $$
regression$# declare tmp text;
regression$# begin
regression$#   tmp := $1;
regression$#   tmp := tmp;
regression$#   return tmp;
regression$# end$$ language plpgsql stable;
regression=# select copyit('foo');
ERROR:  out of memory
DETAIL:  Failed on request of size 1065320319.
CONTEXT:  PL/pgSQL function "copyit" line 4 at assignment

This makes it perfectly clear that the problem is that exec_assign_value
must copy the given value before it frees the old, just in case they're
the same.  (Hmm, I wonder if we can shortcircuit the whole thing ...)

			regards, tom lane

In response to


pgsql-bugs by date

Next:From: Magnus HaganderDate: 2005-06-20 20:01:04
Subject: Re: BUG #1721: mutiple bytes character string comaprison error
Previous:From: Tom LaneDate: 2005-06-20 19:40:21
Subject: Re: BUG #1723: array_cat() bug when passed empty array

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group