[SQL] count array in postgresql

2005-03-06 Thread bandeng
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 ---

[SQL] count array in plpgsql

2005-03-06 Thread bandeng
hello guys, I need some help, I have created function with argument in array. I already try to find array function in manual but I cant. so is there any solution to counting array value and looping array value? any some language usually use count($array) Thank in a bunch Ricky Wibowo -- Gutten

Re: [SQL] Links between rows in a table

2005-03-06 Thread Bruno Wolff III
On Sun, Mar 06, 2005 at 05:42:14 +0100, Stefan Weiss <[EMAIL PROTECTED]> wrote: > > We are currently designing a web-based application in which users can > add other users as "friends". These links are bi-directional, meaning > that when A adds B to his friends, he is automatically one of B's >

Re: [SQL] Links between rows in a table

2005-03-06 Thread Stefan Weiss
On 2005-03-06 18:42, Bruno Wolff III wrote: >> We are currently designing a web-based application in which users can >> add other users as "friends". These links are bi-directional, meaning >> that when A adds B to his friends, he is automatically one of B's >> friends. Eventually we will have to a

Re: [SQL] count array in postgresql

2005-03-06 Thread Michael Fuhr
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 s

Re: [SQL] Links between rows in a table

2005-03-06 Thread PFC
It would probably be better to always have either both or neither of the symmetric relationships in the table. You could make a set of triggers to enforce this. Because your relation is symmetric, you should not name them "user" and "friend". The duplication is useless if you add a constraint

Re: [SQL] Postgres performance

2005-03-06 Thread PFC
Really ? In my experience this is a sure way to get inconsistencies slowly creeping into your database, and you also get a load of funky concurrency issues. Yes, you are rigth... my insert/update are very simple and without problems and so I think to use 'foreign key' coded to make

Re: [SQL] Building a database from a flat file

2005-03-06 Thread Andrew - Supernews
On 2005-03-03, Markus Schaber <[EMAIL PROTECTED]> wrote: > - Create the new date in another schema, and then simply rename those > two schemas for "switch over" This kind of thing looks superficially attractive but it has some serious problems if you try and do it while there is other database act

Re: [SQL] Links between rows in a table

2005-03-06 Thread Stefan Weiss
On 2005-03-06 20:26, PFC wrote: > Because your relation is symmetric, you should not name them "user" and > > "friend". A good point, thank you. > user_id_1 < user_id_2 means : > - a user can't be his own friend > - only one row per friend > - when you want to kno

Re: [SQL] count array in postgresql

2005-03-06 Thread bandeng
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 :=

Re: [SQL] count array in postgresql

2005-03-06 Thread Sean Davis
How about array_dims? It looks like you will still have to do a string split, but Sean - Original Message - From: "bandeng" <[EMAIL PROTECTED]> To: 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 c

Re: [SQL] count array in postgresql

2005-03-06 Thread Michael Fuhr
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/ ---(end of broadcast)--- TIP 5: Have you checked our