pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedcount array in postgresql
5+ messages / 3 participants
[nested] [flat]
* count array in postgresql
@ 2005-03-06 16:54 bandeng <postgredb@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: bandeng @ 2005-03-06 16:54 UTC (permalink / raw)
To: pgsql-sql
hello guys,
I need some help, I have created function with argument in array.
I already try to find array function in manual but failed.
so is there any solution to counting array value and looping array value?
some language usually use count($array)
Thank in a bunch
Ricky
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: count array in postgresql
@ 2005-03-06 19:10 Michael Fuhr <mike@fuhr.org>
parent: bandeng <postgredb@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Michael Fuhr @ 2005-03-06 19:10 UTC (permalink / raw)
To: bandeng <postgredb@gmail.com>; +Cc: pgsql-sql
On Sun, Mar 06, 2005 at 11:54:15PM +0700, bandeng wrote:
> I need some help, I have created function with argument in array.
> I already try to find array function in manual but failed.
Maybe you're looking for "Array Functions and Operators" in the
"Functions and Operators" chapter. You don't say what version of
PostgreSQL you're using; here's a link to the 8.0 documentation:
http://www.postgresql.org/docs/8.0/interactive/functions-array.html
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: count array in postgresql
@ 2005-03-07 02:09 bandeng <postgredb@gmail.com>
parent: Michael Fuhr <mike@fuhr.org>
0 siblings, 2 replies; 5+ messages in thread
From: bandeng @ 2005-03-07 02:09 UTC (permalink / raw)
To: pgsql-sql
my Postgresql version is 7.4
I still cannot find count function in that reference. but I try to use
like this just checking the array value is null or not, it's work but
dunno it is the good way or not.
for example,
vararray := {ab,cd,ef,gh}
i := 1;
while vararray[i] is not null loop
i := i + 1;
end loop;
raise info i;
On Sun, 6 Mar 2005 12:10:55 -0700, Michael Fuhr <mike@fuhr.org> wrote:
> On Sun, Mar 06, 2005 at 11:54:15PM +0700, bandeng wrote:
>
> > I need some help, I have created function with argument in array.
> > I already try to find array function in manual but failed.
>
> Maybe you're looking for "Array Functions and Operators" in the
> "Functions and Operators" chapter. You don't say what version of
> PostgreSQL you're using; here's a link to the 8.0 documentation:
>
> http://www.postgresql.org/docs/8.0/interactive/functions-array.html
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>
--
Gutten Aben Sugeng Sonten, Jangane Kurang Santen
bandeng....................
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: count array in postgresql
@ 2005-03-07 02:21 Sean Davis <sdavis2@mail.nih.gov>
parent: bandeng <postgredb@gmail.com>
1 sibling, 0 replies; 5+ messages in thread
From: Sean Davis @ 2005-03-07 02:21 UTC (permalink / raw)
To: bandeng <postgredb@gmail.com>; pgsql-sql
How about array_dims? It looks like you will still have to do a string
split, but....
Sean
----- Original Message -----
From: "bandeng" <postgredb@gmail.com>
To: <pgsql-sql@postgresql.org>
Sent: Sunday, March 06, 2005 9:09 PM
Subject: Re: [SQL] count array in postgresql
> my Postgresql version is 7.4
>
> I still cannot find count function in that reference. but I try to use
> like this just checking the array value is null or not, it's work but
> dunno it is the good way or not.
>
> for example,
> vararray := {ab,cd,ef,gh}
>
> i := 1;
> while vararray[i] is not null loop
> i := i + 1;
> end loop;
>
> raise info i;
>
>
>
> On Sun, 6 Mar 2005 12:10:55 -0700, Michael Fuhr <mike@fuhr.org> wrote:
>> On Sun, Mar 06, 2005 at 11:54:15PM +0700, bandeng wrote:
>>
>> > I need some help, I have created function with argument in array.
>> > I already try to find array function in manual but failed.
>>
>> Maybe you're looking for "Array Functions and Operators" in the
>> "Functions and Operators" chapter. You don't say what version of
>> PostgreSQL you're using; here's a link to the 8.0 documentation:
>>
>> http://www.postgresql.org/docs/8.0/interactive/functions-array.html
>>
>> --
>> Michael Fuhr
>> http://www.fuhr.org/~mfuhr/
>>
>
>
> --
> Gutten Aben Sugeng Sonten, Jangane Kurang Santen
> bandeng....................
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: count array in postgresql
@ 2005-03-07 03:29 Michael Fuhr <mike@fuhr.org>
parent: bandeng <postgredb@gmail.com>
1 sibling, 0 replies; 5+ messages in thread
From: Michael Fuhr @ 2005-03-07 03:29 UTC (permalink / raw)
To: bandeng <postgredb@gmail.com>; +Cc: pgsql-sql
On Mon, Mar 07, 2005 at 09:09:57AM +0700, bandeng wrote:
> I still cannot find count function in that reference.
See array_upper() and array_lower().
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2005-03-07 03:29 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-06 16:54 count array in postgresql bandeng <postgredb@gmail.com>
2005-03-06 19:10 ` Michael Fuhr <mike@fuhr.org>
2005-03-07 02:09 ` bandeng <postgredb@gmail.com>
2005-03-07 02:21 ` Sean Davis <sdavis2@mail.nih.gov>
2005-03-07 03:29 ` Michael Fuhr <mike@fuhr.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox