BUG #14550: Select statement and function gives different value for same query.

From: deepenpatel(dot)lintel(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14550: Select statement and function gives different value for same query.
Date: 2017-02-17 09:29:43
Message-ID: 20170217092943.6098.33327@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14550
Logged by: Deepen Patel
Email address: deepenpatel(dot)lintel(at)gmail(dot)com
PostgreSQL version: 9.2.18
Operating system: CentOS 7
Description:

Hi,

I have write below query in my function which execute on trigger on
insert.

SELECT report_date INTO logdate FROM agent_statistics WHERE agentid =
NEW.caller_id_name
AND report_date = DATE(NEW.start_stamp);
SELECT COUNT(*) INTO outbound FROM cdr WHERE (caller_id_name =
NEW.caller_id_name
AND direction = 'outbound' AND DATE(NEW.start_stamp) =
logdate);
SELECT COUNT(*) INTO consult FROM cdr WHERE (caller_id_name =
NEW.caller_id_name
AND direction = 'outbound' AND DATE(NEW.start_stamp) =
logdate AND billsec > '0');

------
outbound and consult value does not gives proper values. but, same query by
select statment gives proper value.

I don't understand how's this possible.

please, any one guide to solve this.

Browse pgsql-bugs by date

  From Date Subject
Next Message Stefan Stefanov 2017-02-17 09:43:33 Re: BUG #14549: pl/pgsql parser
Previous Message Emre Hasegeli 2017-02-17 09:21:06 Re: BUG #14546: "point" type does not work with "IS DISTINCT"