The following bug has been logged on the website:
Bug reference: 8648
Logged by: Arjen Nienhuis
Email address: a.g.nienhuis@gmail.com
PostgreSQL version: 9.1.10
Operating system: Ubuntu
Description:
Hi,
I found a bug trying to use EXISTS with a table with no columns. It works
with SELECT 1 and not with SELECT *:
arjen=> SELECT VERSION();
version
-------------------------------------------------------------------------------------------------------------
PostgreSQL 9.1.10 on x86_64-unknown-linux-gnu, compiled by gcc
(Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3, 64-bit
(1 row)
arjen=> CREATE TABLE test ();
CREATE TABLE
arjen=> SELECT EXISTS (SELECT 1 FROM test);
?column?
----------
f
(1 row)
arjen=> SELECT EXISTS (SELECT * FROM test);
The connection to the server was lost. Attempting reset: Failed.
!>
In the log:
2013-12-03 01:23:36 CET LOG: server process (PID 17249) was terminated by
signal 11: Segmentation fault
2013-12-03 01:23:36 CET LOG: terminating any other active server processes
2013-12-03 01:23:36 CET WARNING: terminating connection because of crash of
another server process
2013-12-03 01:23:36 CET DETAIL: The postmaster has commanded this server
process to roll back the current transaction and exit, because another
server process exited abnormally and possibly corrupted shared memory.
2013-12-03 01:23:36 CET HINT: In a moment you should be able to reconnect
to the database and repeat your command.