Aggregate function: Different results with jdbc and psql

Поиск
Список
Период
Сортировка
Искать
От
Tilman Rassy
Тема
Aggregate function: Different results with jdbc and psql
Дата
Msg-id
200810071326.56837.rassy@math.tu-berlin.de
Список
Дерево обсуждения
Aggregate function: Different results with jdbc and psql Tilman Rassy <rassy@math.TU-Berlin.DE>
Re: Aggregate function: Different results with jdbc and psql Tom Lane <tgl@sss.pgh.pa.us>
Re: Aggregate function: Different results with jdbc and psql Tilman Rassy <rassy@math.TU-Berlin.DE>
Re: Aggregate function: Different results with jdbc and psql Tilman Rassy <rassy@math.TU-Berlin.DE>
Re: Aggregate function: Different results with jdbc and psql Guillaume Cottenceau <gc@mnc.ch>
Re: Aggregate function: Different results with jdbc and psql Tilman Rassy <rassy@math.TU-Berlin.DE>
Re: Aggregate function: Different results with jdbc and psql Guillaume Cottenceau <gc@mnc.ch>
Re: Aggregate function: Different results with jdbc and psql Tilman Rassy <rassy@math.TU-Berlin.DE>
Re: Aggregate function: Different results with jdbc and psql "Marc Mamin" <M.Mamin@intershop.de>
Re: Aggregate function: Different results with jdbc and psql Tilman Rassy <rassy@math.TU-Berlin.DE>
Re: Aggregate function: Different results with jdbc and psql "Marc Mamin" <M.Mamin@intershop.de>
Hello,

I have the following problem: A certain query, i.e.,

SELECT * FROM user_worksheet_grades WHERE user_id = 23 AND worksheet_id = 105;

gives

 worksheet_id | user_id | num_edited | num_corrected | grade 
--------------+---------+------------+---------------+-------
          105 |      23 |          1 |             1 |     4
(1 row)

when I issue it in psql. When I use the same query from JDBC in Java, the 
column "grade" is SQL NULL.

The table "user_worksheet_grades" is actually a view which gets its data from 
two other views, one of which is defined as follows:

SELECT
  wks.id AS worksheet_id,
  ann.the_user AS user_id,
  count(ann.ann_type) AS num_corrected,
  sum(ref_wks_prb.points * ann.score) AS grade
FROM
 latest_worksheets wks, refs_worksheet_generic_problem ref_wks_prb, 
anns_user_worksheet_generic_problem ann
WHERE ann.ref = ref_wks_prb.id
AND ref_wks_prb.from_doc = wks.id AND ann.ann_type = 2
GROUP BY wks.id, ann.the_user;

Thus, "grade" is defined as a sum of products.

I use PostgreSQL 8.2.3 on Linux.

Any help will be appreciated!

Tilman
В списке pgsql-jdbc по дате отправления
От: Alexander Panzhin
Дата:
От: Tilman Rassy
Дата:
FAQ