[SQL] Updatable view

2005-06-30 Thread M.D.G. Lange
I have been looking around to get an idea how to make RULES on a VIEW for INSERT , UPDATE and DELETE of a VIEW with an INNER JOIN. First the idea: There are 3 tables, those are related one way or another, combined in this view: pg_user (ok, it's a view really) tblcontacts (with contact informa

Re: [SQL] ORDER records based on parameters in IN clause

2005-06-30 Thread M.D.G. Lange
Another option would be: SELECT * FROM table WHERE id=2003 OR id=1342 OR id=799 OR id=1450; This should give you the results in the right order... - Michiel Scott Marlowe wrote: On Wed, 2005-06-29 at 09:22, Russell Simpkins wrote: fair enough. but a simple order by id would never work.

Re: [SQL] Unique primary index?

2005-06-28 Thread M.D.G. Lange
I would say that you should learn a bit about relational databases before you start working with them ;-) All unique fields (or combinations of fields that -combined- are unique) can serve as a primary key. In relational databases we call them 'candidate key'. if you have more than one candid

Re: [SQL] Function does not return, but gives error..

2005-06-16 Thread M.D.G. Lange
my bad: please forget my previous mail, I tested it with a filled group, which is of course not empty... the solution was correct, thanks! Gnanavel Shanmugam wrote: -Original Message- From: [EMAIL PROTECTED] Sent: Thu, 16 Jun 2005 14:26:39 +0200 To: pgsql-sql@postgresql.org Subject: [S

Re: [SQL] Function does not return, but gives error..

2005-06-16 Thread M.D.G. Lange
Gnanavel Shanmugam wrote: -Original Message- From: [EMAIL PROTECTED] Sent: Thu, 16 Jun 2005 14:26:39 +0200 To: pgsql-sql@postgresql.org Subject: [SQL] Function does not return, but gives error.. I have the following function to determine wether or not a user is member of a group, howe

[SQL] Function does not return, but gives error..

2005-06-16 Thread M.D.G. Lange
I have the following function to determine wether or not a user is member of a group, however I have a small problem with it: a group without members results in groupres being NULL (I have checked this), however IF groupres = NULL THEN ... END IF; is not trapped... I have tried to use array_uppe

[SQL] foreign key on pg_shadow

2005-06-14 Thread M.D.G. Lange
Dear list, Upon designing our application we thought that the following setup would be a good idea to implement security: Using the pg_shadow table as it is: | pg_shadow | +-+ | usename | | usesysid| | usecreatedb | | usesuper| | usecatupd | | passwd | | valunt

[SQL] rule or trigger?

2005-06-07 Thread M.D.G. Lange
In order for a "dictionary" system I have created the following system: tbllanguages - ID - name Primary key ( ID ) tbldictionary - wordid - languageid - value Primary key ( wordid, languageid) The idea is to have a word id in several languages, so you only have to look up the word id and give