Is it a bug?

From: "Mauricio da Silva Barrios" <typedeath(at)zipmail(dot)com(dot)br>
To: <pgsql-hackers(at)postgresql(dot)org>
Cc: <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Is it a bug?
Date: 2000-02-18 16:33:57
Message-ID: 20000218163357.1404B729C@zipmx11.zipmail.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, people!

I'm having a problem with postgres, and I wanna know if anyone out there
might give me some help...

My problem is this:
I have a table. When I run a select over it, the result comes OK. BUT,
if I create a view with the same select, when I run a select on the view,
if the table has any data my computer explodes on my face! I have made
other views, and they work fine, but they dont have subqueries with
reference to its parent query.

Have any of you ever faced this problem, or created a view like mine that
worked? how do I overcome my troubles??

Here follow my select, my table and all things I did (not much) to
generate the crash.

If you think you might help me and want more info about my system or
postgres, mail me.

-------------------------------------------------------------------------
-------
[user(at)server dir]$ psql mydb
Welcome to POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of PSTGRESQL
[PostgreSQL 6.5.3 on i686-pc-linux-gnu, compiled by gcc pgcc-2.91.66]

type \? for help on slash commands
type \q to quit
type \g or terminate with semicolon to execute query
You are currently connected to the database: mydb

mydb=> CREATE TABLE connection (
connection_id INT4 primary key,
connection_owner INT4, -- Foreign Key for users table
connection_start TIMESTAMP,
connection_end RELTIME
);
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
'connection_pkey' for table 'connection'
CREATE
mydb=> CREATE VIEW connection_last AS
SELECT * FROM connection as con_out
WHERE connection_start IN ( SELECT max(connection_start) FROM
connection as con_in
WHERE con_in.connection_owner =
con_out.connection_owner
GROUP BY connection_owner);
CREATE
mydb=> SELECT * FROM connection_last;
connection_id|connection_owner|connection_start|connection_end
-------------+----------------+----------------+--------------
(0 rows)

mydb=> INSERT INTO connection VALUES (3,'2','22-01-01','122');
INSERT 172197 1
mydb=> select * from connection;
connection_id|connection_owner|connection_start |connection_end
-------------+----------------+----------------------+---------------
3| 2|2001-01-22 00:00:00-02|@ 2 mins 2 secs
(1 row)

mydb=> SELECT * FROM connection as con_out
WHERE connection_start IN ( SELECT max(connection_start) FROM
connection as con_in
WHERE con_in.connection_owner =
con_out.connection_owner
GROUP BY connection_owner);
connection_id|connection_owner|connection_start |connection_end
-------------+----------------+----------------------+---------------
3| 2|2001-01-22 00:00:00-02|@ 2 mins 2 secs
(1 row)

mydb=> select * from connection_last;
pqReadData() -- backend closed the channel unexpectedly.
This probably means the backend terminated abnormally
before or while processing the request.
We have lost the connection to the backend, so further processing is
impossible.
Terminating.
[user(at)server dir]$
-------------------------------------------------------------------------
-----------
_____________________________________________________________
GUNS N' ROSES.
Eles estão de volta no novo CD Live Era 87-93. Fundamental para entender
a história do rock dos anos 90. Fundamental comprar logo. Só R$ 20,90 no Submarino.
PROMOÇÃO MOUSE VERMELHO
http://www.submarino.com.br/default.asp?franq=100037

_____________________________________________________________

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2000-02-18 23:36:38 Re: SQL compliance - why -- comments only at psql level ?
Previous Message Mauricio da Silva Barrios 2000-02-18 16:33:51 Is it a bug?