
------- Forwarded Message

Date:    Fri, 25 May 2001 00:47:13 +0200
From:    Michal Politowski <mpol@charybda.icm.edu.pl>
To:      Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Bug#98643: plpgsql SELECT INTO causes trouble when assignment impossib
	  le

Package: postgresql
Version: 7.1.1-4
Severity: important

After
psql template1 -f x.sql

where x.sql looks as follows:

- ----- x.sql -----
CREATE DATABASE test;
\c test
CREATE TABLE foo (bar int4);
INSERT INTO foo VALUES (17);
CREATE FUNCTION quux() RETURNS int4 AS '
DECLARE
	baz int4;
BEGIN
	SELECT INTO baz bar FROM foo WHERE bar > 23;
	RETURN 42;
END;
' LANGUAGE 'plpgsql';
SELECT quux();
- ----------

I get this on screen:

CREATE DATABASE
You are now connected to database test.
CREATE
INSERT 117035 1
CREATE
psql:x.sql:13: pqReadData() -- backend closed the channel unexpectedly.
        This probably means the backend terminated abnormally
	before or while processing the request.
psql:x.sql:13: connection to server was lost

And this in logs:
May 25 00:39:13 Amber postgres[15856]: [1] DEBUG:  connection: host=[local] use
r=mike database=template1
May 25 00:39:13 Amber postgres[15858]: [1] DEBUG:  connection: host=[local] use
r=mike database=test
May 25 00:39:13 Amber postgres[15859]: [1] DEBUG:  database system was interrup
ted at 2001-05-25 00:38:16 CEST
May 25 00:39:13 Amber postgres[15859]: [2] DEBUG:  CheckPoint record at (0, 377
3544)
May 25 00:39:13 Amber postgres[15859]: [3] DEBUG:  Redo record at (0, 3773544);
 Undo record at (0, 0); Shutdown TRUE
May 25 00:39:13 Amber postgres[15859]: [4] DEBUG:  NextTransactionId: 1134; Nex
tOid: 117024
May 25 00:39:13 Amber postgres[15859]: [5] DEBUG:  database system was not prop
erly shut down; automatic recovery in progress...
May 25 00:39:13 Amber postgres[15859]: [6] DEBUG:  redo starts at (0, 3773608)
May 25 00:39:13 Amber postgres[15859]: [7] DEBUG:  ReadRecord: record with zero
 len at (0, 3883500)
May 25 00:39:13 Amber postgres[15859]: [8] DEBUG:  redo done at (0, 3883464)
May 25 00:39:16 Amber postgres[15859]: [9] DEBUG:  database system is in produc
tion state

- -- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux Amber 2.2.19 #1 Thu Mar 29 15:52:51 CEST 2001 i586
Locale: LANG=pl_PL, LC_CTYPE=C

Versions of packages postgresql depends on:
ii  debianutils                   1.15       Miscellaneous utilities specific t
ii  libc6                         2.2.3-1    GNU C Library: Shared libraries an
ii  libpgsql2.1                   7.1.1-4    Shared library libpq.so.2.1 for Po
ii  libreadline4                  4.2-3      GNU readline and history libraries
ii  libssl0.9.6                   0.9.6a-3   SSL shared libraries              
ii  postgresql-client             7.1.1-4    Front-end programs for PostgreSQL 
ii  procps                        1:2.0.7-4  The /proc file system utilities.  
ii  zlib1g                        1:1.1.3-15 compression library - runtime     

- -- 
Michal Politowski -- mpol@lab.icm.edu.pl
Warning: this is a memetically modified message


------- End of Forwarded Message


-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "And Jesus answering said unto them, They that are
      whole need not a physician; but they that are sick. I
      come not to call the righteous, but sinners to
      repentance."                     Luke 5:31,32



Fri, 25 May 2001 07:08:15 +0100
"Oliver Elphick" <olly@lfix.co.uk>
Bug#98643: plpgsql SELECT INTO causes trouble when assignment
	impossible (fwd)
"Oliver Elphick" <olly@lfix.co.uk> writes:
> psql:x.sql:13: pqReadData() -- backend closed the channel unexpectedly.

This is the already-fixed-in-7.1.2 problem with empty SELECTs in
plpgsql.

			regards, tom lane

Fri, 25 May 2001 10:23:01 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Bug#98643: plpgsql SELECT INTO causes trouble when assignment
	impossible (fwd)