INSERT INTO ... SELECT

Started by Jiang Weiabout 22 years ago2 messagesbugs
Jump to latest
#1Jiang Wei
sdjiangwei@sina.com

=>create table empty();

=>insert into empty default values;
=>insert into empty select * from empty;

server crash.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jiang Wei (#1)
Re: INSERT INTO ... SELECT

Jiang Wei <sdjiangwei@sina.com> writes:

=>create table empty();
=>insert into empty default values;
=>insert into empty select * from empty;
server crash.

Fixed, thanks for the report.

regards, tom lane

Index: execJunk.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/executor/execJunk.c,v
retrieving revision 1.36
retrieving revision 1.36.4.1
diff -c -r1.36 -r1.36.4.1
*** execJunk.c	11 Aug 2003 20:46:46 -0000	1.36
--- execJunk.c	7 Apr 2004 18:46:20 -0000	1.36.4.1
***************
*** 262,273 ****
  	cleanTupType = junkfilter->jf_cleanTupType;
  	cleanLength = junkfilter->jf_cleanLength;
  	cleanMap = junkfilter->jf_cleanMap;
- 
- 	/*
- 	 * Handle the trivial case first.
- 	 */
- 	if (cleanLength == 0)
- 		return (HeapTuple) NULL;
  	/*
  	 * Create the arrays that will hold the attribute values and the null
--- 262,267 ----