[BUGS] BUG #14550: Select statement and function gives different value forsame query. - Mailing list pgsql-bugs

From deepenpatel.lintel@gmail.com
Subject [BUGS] BUG #14550: Select statement and function gives different value forsame query.
Date
Msg-id 20170217092943.6098.33327@wrigleys.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      14550
Logged by:          Deepen Patel
Email address:      deepenpatel.lintel@gmail.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.



--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: Emre Hasegeli
Date:
Subject: Re: [BUGS] BUG #14546: "point" type does not work with "IS DISTINCT"
Next
From: Stefan Stefanov
Date:
Subject: Re: [BUGS] BUG #14549: pl/pgsql parser