Rewritten queries

Поиск
Список
Период
Сортировка
Искать
От
Keith Worthington
Тема
Rewritten queries
Дата
Msg-id
20041227184511.M18423@narrowpathinc.com
Список
Дерево обсуждения
Rewritten queries "Keith Worthington" <keithw@narrowpathinc.com>
Re: Rewritten queries Jaime Casanova <systemguards@yahoo.com>
Re: Rewritten queries Jaime Casanova <systemguards@yahoo.com>
Re: Rewritten queries Tom Lane <tgl@sss.pgh.pa.us>
Re: Rewritten queries Jaime Casanova <systemguards@yahoo.com>
Hi All,

I wrote a query that created a view and when I looked at it in the database
the SELECT statement was very different.  In part

SELECT items.id,
       COALESCE(sales.sum, 0) AS committed,
       COALESCE(purchases.sum, 0) AS on_order,
       COALESCE(stock.quantity, 0) AS on_hand
  FROM peachtree.tbl_item AS items...

was changed to

CREATE OR REPLACE VIEW interface.view_inventory AS 

 SELECT items.id, 
        CASE 
            WHEN (sales.sum IS NOT NULL ) THEN sales.sum 
            WHEN (0 IS NOT NULL ) THEN (0 )::real 
            ELSE NULL::real 
        END  AS "committed", 
        CASE 
            WHEN (purchases.sum IS NOT NULL ) THEN purchases.sum 
            WHEN (0 IS NOT NULL ) THEN (0 )::real 
            ELSE NULL::real 
        END  AS on_order, 
        CASE 
            WHEN (stock.quantity IS NOT NULL ) THEN stock.quantity 
            WHEN (0 IS NOT NULL ) THEN (0 )::real 
            ELSE NULL::real 
        END  AS on_hand 
   FROM (((peachtree.tbl_item items 

Is this expected behavior?  Should I be concerned?  Is the modified query
faster?  Better in some way?  Should I be writing my queries to conform with
the modified syntax?

Kind Regards,
Keith

______________________________________________
99main Internet Services http://www.99main.com

В списке pgsql-novice по дате отправления
От: Keith Worthington
Дата:
От: Jaime Casanova
Дата:
Сообщение: Re: Rewritten queries
FAQ