On Friday 26 May 2006 09:45, Gurjeet Singh wrote:
> Something not supported should be stated as such through an ERROR. Except
> for count(), none of the following make any sense:
>
> The transcipt:
>
> test=# \d t1
>       Table "public.t1"
> Column |  Type   | Modifiers
> --------+---------+-----------
> a      | integer | not null
> Indexes:
>     "t1_pkey" PRIMARY KEY, btree (a)
>
> test=# select * from t1;
>  a
> ---
> 1
> 2
> 3
> 4
> 5
> (5 rows)
>

given:

pagila=# select 1 from t1;
 ?column?
----------
        1
        1
        1
        1
        1
(5 rows)

> test=# select count(*) from t1;
> count
> -------
>      5
> (1 row)
>

this makes sense

> test=# select count(1) from t1;
>  count
> -------
>      5
> (1 row)
>

and so does this

> test=# select max(*) from t1;
>  max
> -----
>    1
> (1 row)
>

not so much 

> test=# select max(1) from t1;
> max
> -----
>    1
> (1 row)
>

but this does

> test=# select min(*) from t1;
>  min
> -----
>    1
> (1 row)
>

not here though

> test=# select avg(*) from t1;
>           avg
> ------------------------
>  1.00000000000000000000
> (1 row)
>

nor here 

> test=# select sum(*) from t1;
>  sum
> -----
>    5
> (1 row)
>

or here

> test=# select sum(1) from t1;
>  sum
> -----
>    5          <--- this is correct
> (1 row)
>
> test=#

yep... but really most aggregates are ok with a 1 

-- 
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to