From: | "Mike Landis" <mlandis(at)pnmx(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #5160: complex query parsing bug |
Date: | 2009-11-02 21:15:09 |
Message-ID: | 200911022115.nA2LF9qW002916@wwwmaster.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged online:
Bug reference: 5160
Logged by: Mike Landis
Email address: mlandis(at)pnmx(dot)com
PostgreSQL version: 1.8.4
Operating system: Vista
Description: complex query parsing bug
Details:
The SQL parser in pgAdmin III v1.8.4 build 7358 thinks that there should be
more input at the end of the following multi-join query. Subqueries have
been verified correct. I think the parser got lost... Mike
SELECT SP.basis,
SP.shares,
SP.stock_id,
SP.portfolio_id,
HP.last_date,
HP.price,
symbol,
exchange,
company_name
FROM stocks
JOIN
(SELECT HP_LAST.stock_id,
last_date, price
FROM (SELECT stock_id, date, close AS price
FROM historical_stock_prices
) AS HP_ALL
JOIN
(SELECT stock_id, MAX(date) AS last_date
FROM historical_stock_prices
GROUP BY stock_id
) AS HP_LAST
ON HP_ALL.stock_id = HP_LAST.stock_id
AND HP_ALL.DATE = HP_LAST.last_date
) AS HP
JOIN
(SELECT stock_id,
portfolio_id,
SUM(num_units) AS shares,
SUM(cost_basis) AS basis
FROM stock_positions
WHERE sale_date IS NULL AND portfolio_id = 1
GROUP BY stock_id, portfolio_id
) AS SP
ON SP.stock_id = HP.stock_id
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-11-03 00:20:51 | Re: BUG #5160: complex query parsing bug |
Previous Message | Sergey Konoplev | 2009-11-02 17:45:07 | Re: BUG #5159: 8.4.1 Segmentation fault |