Thread: Re: PL/PG SQL: select count(*) into from where
- does not compute the where cond
Re: PL/PG SQL: select count(*) into from where
- does not compute the where cond
From
"Abraham, Danny"
Date:
... forgot the most import issue The problem shows when the selection is from a view. The where condition does not have names contention. It is: select count(*) into <var> from <view_name> where <cond>
Re: PL/PG SQL: select count(*) into from where
- does not compute the where cond - returns always total count
From
"Abraham, Danny"
Date:
Any idea? Thanks Danny
Re: Re: PL/PG SQL: select count(*) into from where - does not compute the where cond - returns always total count
From
"A. Kretschmer"
Date:
In response to Abraham, Danny : > Any idea? Apparently no, because nobody can reproduce your problem. See my other post, supplementary: test=*# create view view_o as select * from o; CREATE VIEW test=*# create or replace function my_count() returns int as $$declare c int;begin select into c count(1) from view_o where i=2; return c; end;$$language plpgsql; CREATE FUNCTION test=*# select * from my_count(); my_count ---------- 1 (1 row) Regards, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
Re: Re: PL/PG SQL: select count(*) into from where - does not compute the where cond - returns always
total count
From
Martin Gainty
Date:
the "does not compute the where condition" needs more definition
can you supply the table schema and which columns you want?
select count(*) from table will get you the count
We can banter on the need to store in views once the schema is known
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> From: danny_abraham@bmc.com
> To: danny_abraham@bmc.com; pgsql-general@postgresql.org
> Date: Wed, 23 Sep 2009 05:04:09 -0500
> Subject: [GENERAL] Re: PL/PG SQL: select count(*) into <var> from <ANY VIEW> where <cond> - does not compute the where cond - returns always total count
>
> Any idea?
>
> Thanks
>
> Danny
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
Bing brings you health info from trusted sources. Try it now!
can you supply the table schema and which columns you want?
select count(*) from table will get you the count
We can banter on the need to store in views once the schema is known
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> From: danny_abraham@bmc.com
> To: danny_abraham@bmc.com; pgsql-general@postgresql.org
> Date: Wed, 23 Sep 2009 05:04:09 -0500
> Subject: [GENERAL] Re: PL/PG SQL: select count(*) into <var> from <ANY VIEW> where <cond> - does not compute the where cond - returns always total count
>
> Any idea?
>
> Thanks
>
> Danny
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
Bing brings you health info from trusted sources. Try it now!