problem with view

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: problem with view
Date: 1999-03-31 20:11:08
Message-ID: Pine.GSO.3.96.SK.990401000212.29258C-100000@ra
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

reading "The practical SQL handbook" by Bowman et.al (third edition)
I tried to do some examples (there is CD comes with book) and after
porting example bookbiz database to 6.4.2 I found a problem with view:

create view categories
as select type as Category, avg(price) as Average_Price
from titles
group by Category;

bookbiz=> \d categories

Table = categories
+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| category | char() | 12 |
| average_price | money | 4 |
+----------------------------------+----------------------------------+-------+

bookbiz=> select * from categories;
category |average_price
------------+-------------
business |$13.73
mod_cook |$2.99
popular_comp|$22.95
psychology |$13.50
trad_cook |$16.45
|
(6 rows)

bookbiz=> select category,average_price from categories;
category |average_price
------------+-------------
business |$13.73
mod_cook |$2.99
popular_comp|$22.95
psychology |$13.50
trad_cook |$16.45
|
(6 rows)

bookbiz=> select average_price from categories;
pqReadData() -- backend closed the channel unexpectedly.
This probably means the backend terminated abnormally before or while pr
ocessing the request.
We have lost the connection to the backend, so further processing is impossible.

Last query doesn't works ! I don't see possible reason if previous queries
work ok.
My setup:
bookbiz=> select version();
version
------------------------------------------------------------------
PostgreSQL 6.4.2 on i586-pc-linux-gnu, compiled by gcc egcs-2.91.6
(1 row)

Regards,

Oleg

BTW, Does somebody already ported to postgreSQL an example script, which created
bookbiz database from the book ?
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

Browse pgsql-hackers by date

  From Date Subject
Next Message Jackson, DeJuan 1999-03-31 21:33:13 RE: [HACKERS] [OT] Timezones and Daylight savings.
Previous Message Massimo Dal Zotto 1999-03-31 16:39:10 patches for 6.5