[SQL] sql question regarding count(*)

2003-03-06 Thread Rajesh Kumar Mallah

When does count(*) returns "o rows" ?
and when does it return 1 row value being 0.

tradein_clients=# SELECT count(*)   from public.eyp_listing  where sno> 0 and 
amount> 0  group by sno,branch,edition having count(distinct userid) > 1 ;
 count
---
(0 rows)

tradein_clients=#
tradein_clients=#
tradein_clients=# SELECT count(*) from public.users where userid=-1;
 count
---
 0
(1 row)

tradein_clients=#

-- 

Regds
Mallah


Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)

Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Re: [SQL] Arrays Or Loop

2003-03-06 Thread Josh Berkus
Aspire,

>  2. Can we use array for the above thing as
>  a. Make an array of the valid roll_numbers. such as
>  ('IDX'=>'ROLL_NUMBER')
>  b. Now select the array element by the index which will produce the
>  roll_number and work on it.
>  c. Array could be build by for loop
>  3. Will the array approch execute code fast. if yes can you please give me
>  some refrences so that i can actually
>  build one such function.

Unfortunately, the current version of PL/pgSQL have problems with array 
support.  So if you want to test this with arrays, you will have to use 
another language, such as C or Python.

>  4. Lastly if i use views will they help in fas execution

No.   If you want fast execution, try writing the procedure in C.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


[SQL] Cancelling Queries

2003-03-06 Thread Mark Mitchell
I have a Perl program that executes PostgreSQL queries through DBI.
Is there any way to cancel a query once its started. If I could at least
somehow get the PID of the child process postmaster starts I could kill
that.

This may be a better question for the Perl programming list but I
thought I'd ask you guys too

Mark Mitchell




---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly


Re: [SQL] Cancelling Queries

2003-03-06 Thread jasiek
On Thu, Mar 06, 2003 at 06:25:29PM -0500, Mark Mitchell wrote:
> I have a Perl program that executes PostgreSQL queries through DBI.
> Is there any way to cancel a query once its started. If I could at least
> somehow get the PID of the child process postmaster starts I could kill
> that.
> 
> This may be a better question for the Perl programming list but I
> thought I'd ask you guys too
> 
> Mark Mitchell
Use transactions.
Just before query finish you can confirm query (commit) or cancel it
(rollback)

Regards,
Tomasz Myrta

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]