[GENERAL] Updating rows (automatically) that are selected

2006-01-18 Thread Assad Jarrahian
Hello, I have a table called X it contains 3 fields of importance(amongst others). time (timestamp), snooze (int) , inbox (int) The time column sometimes has null values. What I want is that every time a row is selected, if the time is a null value, it is set to now() and snooze is set to 0

[GENERAL] SELECT Rules or stored procedure

2006-01-17 Thread Assad Jarrahian
I have a query that takes two tables (join) and does something on it. Lets say these tables are A and B. What I need is that everytime one of the tables (A) has its rows selected, I want to update the count (which is a column in A) for that row. I am not sure what is the best way to do this. 1)I

Re: [GENERAL] sql (Stored procedure) design question

2006-01-14 Thread Assad Jarrahian
So is it still advisable not to store it in a string format like 'jarraa, mooreg3, flowerpower' [read my comments below please] awaiting some feedback. -assad On 1/12/06, Assad Jarrahian [EMAIL PROTECTED] wrote: Alban and Tino, More explanations lie below. A document contains to field, from

Re: [GENERAL] sql (Stored procedure) design question

2006-01-12 Thread Assad Jarrahian
] ;) hehe maybe I can do a hybrid, storing the string completely in the doc table and storing all the to fields as a document_to table. Awaiting your thoughts. thanks! -Assad ... On 1/11/06, Tom Lane [EMAIL PROTECTED] wrote: Assad Jarrahian [EMAIL PROTECTED] writes: A column of type

Re: [GENERAL] sql (Stored procedure) design question

2006-01-12 Thread Assad Jarrahian
) Group Schema (2 tables) (groupID, groupname, groupInfo) (groupID, oneOfTheManyGroupMembers) Hope this helps and that I am making sense now. Sorry for the confusion. -assad On 1/12/06, Tino Wildenhain [EMAIL PROTECTED] wrote: Assad Jarrahian schrieb: Tino, thanks for your response Your

[GENERAL] getting access to geodistance (what do I need to install/enable) in an existing db install

2006-01-11 Thread Assad Jarrahian
Hi, I was running postgres 8.1 on a windows xp box and I recall installing it with postgis option. I had a method in a db there that called geodistance. Everything worked fine. Now I tried to restore the db on the debian server thats running 8.1 as well. The geodistance function (or any other

Re: [GENERAL] getting access to geodistance (what do I need to install/enable) in an existing db install

2006-01-11 Thread Assad Jarrahian
do not have postgis installed). How would I go about installing (debian apt) and adding it to my current db. Much thanks in advance. -assad On 1/11/06, Michael Fuhr [EMAIL PROTECTED] wrote: On Wed, Jan 11, 2006 at 02:40:04PM -0700, Assad Jarrahian wrote: I was running postgres 8.1

Re: [GENERAL] getting access to geodistance (what do I need to install/enable) in an existing db install

2006-01-11 Thread Assad Jarrahian
to install postgis on the debian box and cannot find the contrib directory. thanks for your help -assad On 1/11/06, Michael Fuhr [EMAIL PROTECTED] wrote: [Please copy the mailing list on replies.] On Wed, Jan 11, 2006 at 08:02:56PM -0700, Assad Jarrahian wrote: I tried that, but it said

[GENERAL] sql (Stored procedure) design question

2006-01-11 Thread Assad Jarrahian
Problem: A column of type text contains username's and groupname's followed by comma (eg. 'jarraa, mooreg3, keith') [it is stored this way because it will be displayed in this format]. What is needed is a constrain check. To make sure that every time a row is inserted into the table, this

Re: [GENERAL] sql (Stored procedure) design question

2006-01-11 Thread Assad Jarrahian
document to a stored procedure and then the stored procedure takes the text component of it and tokenizes it and then I do constraint checks on it? thanks. -assad On 1/11/06, Tom Lane [EMAIL PROTECTED] wrote: Assad Jarrahian [EMAIL PROTECTED] writes: A column of type text contains

Re: [GENERAL] userdefined types

2006-01-09 Thread Assad Jarrahian
be much appreciated. -assad On 1/9/06, Tom Lane [EMAIL PROTECTED] wrote: Assad Jarrahian [EMAIL PROTECTED] writes: UPDATE userprofiles SET address = ROW( ,'','','',,'',,'','','','','','','','','','') where username='mooreg3'; ERROR: syntax error at or near , at character 41 That first comma

[GENERAL] calling stored procedure with array paramenter (for psql)

2006-01-09 Thread Assad Jarrahian
I have a pg_psql stored procedure getlms(_int4) from psql SELECT * fROM get_lms(ARRAY[12,23,34]); that does not work. How do I pass an array to a function in psql? Please help. Thanks. -assad ---(end of broadcast)--- TIP 1: if posting/reading

Re: [GENERAL] calling stored procedure with array paramenter (for psql)

2006-01-09 Thread Assad Jarrahian
PROTECTED] wrote: On Mon, Jan 09, 2006 at 05:33:53PM -0700, Assad Jarrahian wrote: I have a pg_psql stored procedure getlms(_int4) from psql SELECT * fROM get_lms(ARRAY[12,23,34]); that does not work. How do I pass an array to a function in psql? Could you explain what does

[GENERAL] userdefined types

2006-01-08 Thread Assad Jarrahian
Hello, So I have been reading over the web and it seems that one must define two methods before declaring a type. But I seem to have done it (CREATE TYPE) without creating any functions and it did not give me an error. I tried to use INSERT TABLENAME SET user-defined-column = ROW('val1' ,'va2'

Re: [GENERAL] userdefined types

2006-01-08 Thread Assad Jarrahian
Lane [EMAIL PROTECTED] wrote: Assad Jarrahian [EMAIL PROTECTED] writes: it does not like the commas one after the other (empty value) how do I solve that or does this have something to do with those two methods (in and out) that I overlooked. any insight would be much appreciated

[GENERAL] SQLData user-defined-types and getObject()

2006-01-07 Thread Assad Jarrahian
Hi All, I am quite confused (PLEASE PLEASE Help), I cannot find anything on the web). I read that you can declare a class that implements SQLData (in this case I set up a class called Complex from the /src/tutorial datatype that mimics the user-defined datatype in the db) and then set the

[GENERAL] pg admin III and primary keys (for backup/restore)

2006-01-04 Thread Assad Jarrahian
Environment: Deployed on Debian. Test and Development on Windows. Using pg_admin III and Postgresql 8.1 (both test and development). I want to backup Development and restore it in test and vice-versa. So when I do a backup of the db (in PGAdmin III), it backs it up. But when I restore it, all

[GENERAL] Storing images in a db (for web/midlet access)

2005-12-28 Thread Assad Jarrahian
Hi All, So I am trying to store images in the db which will be accessed from a midlet and website. So I looked into generating temp files, such as the one done here using servlets (http://fdegrelle.over-blog.com/categorie-275139.html). What I am confused about is that this may not be very

[GENERAL] problems with currval and rollback

2005-12-22 Thread Assad Jarrahian
Hi all, So I started to make some changes with my code here and there (nothing to do with the relevant lines) and suddenly currval and rollback don't work. try{ db.setAutoCommit(false); addLM.setInt(1, lm.getOrigin());

Re: [GENERAL] problems with currval and rollback

2005-12-22 Thread Assad Jarrahian
find the queries that are being run by Java and type them into psql to see if they work there. If not, please show them to us. --- Assad Jarrahian wrote: Hi all, So I started to make some changes with my code here

[GENERAL] pl_pgSQL array parameter and order of results returned

2005-12-03 Thread Assad Jarrahian
Hi All, I have a quick question. So I pass an array (int containing primary keys) to a pgSQL function and I want the results to be in the exact same order as the ints in the array. Is there a way to do this ? currently my code looks like this CREATE OR REPLACE FUNCTION getlms(_int4) RETURNS

[GENERAL] keeping track of inserts (periodical) into a table

2005-12-03 Thread Assad Jarrahian
Hi all, I have a design decission to make. I am using Lucene (Java Search API) and I need to update lucenes index from time to time. Is there a way one can keep track of all the inserts coming into a table (holding onto their Primary key's are sufficient) and then reseting that after a

[GENERAL] Upgrading from 8.0 to 8.1 on Debian

2005-11-18 Thread Assad Jarrahian
Hi All, I am a bit stumped. So I have a couple of Postgresql versions on my server, namely 8.0 and 8.1 (using Debian package manager). I am trying to get 8.1 to be the default database and delete 8.0 I used pg_dump to dump my db's into a file (Question: Where do I dump the data of the tables in

[GENERAL] help with writing stored procedure

2005-11-10 Thread Assad Jarrahian
Hi, I am trying to write a stored procedure that takes as input an array (one or more integers) and returns all rows matching that ID (primary key of the table): I have this so far: CREATE OR REPLACE FUNCTION getLMs(int[],float(8), float(8)) RETURNS SETOF tp_lm_object AS $$ DECLARE myrec

Re: [GENERAL] Connect to a database in a .sql file

2005-11-08 Thread Assad Jarrahian
with knowledge. Be curtious. Thanks. -assad On 11/8/05, Richard Huxton dev@archonet.com wrote: Assad Jarrahian wrote: \c does not work in .sql script run in psql.That sounds unlikely. What sort of error message are you getting?-- Richard Huxton Archonet Ltd

Re: [GENERAL] Connect to a database in a .sql file

2005-11-08 Thread Assad Jarrahian
Got it. I will be more careful with words. Thanks tom for getting 8.1! one more question. Where does the directory lie for psql (so I can put a .sql file in there and run it) for windows? thanks. -assad On 11/8/05, Richard Huxton dev@archonet.com wrote: Assad Jarrahian wrote: Sorry, I am

Re: [GENERAL] Connect to a database in a .sql file

2005-11-07 Thread Assad Jarrahian
Gore [EMAIL PROTECTED] wrote: On Sun, 6 Nov 2005 18:06:11 -0700, Assad Jarrahian [EMAIL PROTECTED] wrote: Hi, I am writing a .sql file to create a database, connect to it and create tables etc. (basic db setup). But I cannot figure out how to connect to the server (what statement) in a .sql file

[GENERAL] Connect to a database in a .sql file

2005-11-06 Thread Assad Jarrahian
Hi, I am writing a .sql file to create a database, connect to it and create tables etc. (basic db setup). But I cannot figure out how to connect to the server (what statement) in a .sql file. any help would be appreciated. -assad

Re: [GENERAL] pl/pgsql list as parameter.

2005-11-05 Thread Assad Jarrahian
cannot seem to understand how to use setArray() succesfully? Any help would be appreciated. Much thanks. -assad On 11/4/05, Tom Lane [EMAIL PROTECTED] wrote: Assad Jarrahian [EMAIL PROTECTED] writes: How do you take in a list of int?Use an array.regards, tom lane

[GENERAL] pl/pgsql list as parameter.

2005-11-04 Thread Assad Jarrahian
Hi, I have a couple questions, I am tryingto write a function that takes as input a list (size being dynamic) of primaryIDKeys, along with a userdefined type and returns a set of rows containing those keys. Furthermore the rows are exactly (columns) like the table that contains the keys, but has