Is it a bug?

Поиск
Список
Период
Сортировка
От Mauricio da Silva Barrios
Тема Is it a bug?
Дата
Msg-id 20000218163323.346CF7222@zipmx11.zipmail.com.br
обсуждение исходный текст
Ответы Re: Is it a bug?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@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 queryYou are
currentlyconnected to the database: mydb
 

mydb=> CREATE TABLE connection (   connection_id     INT4 primary key,   connection_owner  INT4,  -- Foreign Key for
userstable   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@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

_____________________________________________________________




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Date/time types: big changeu
Следующее
От: "Mauricio da Silva Barrios"
Дата:
Сообщение: Is it a bug?