Re: [SQL] Logging select statements

2003-07-08 Thread Rudi Starcevic
Thanks Achilleus, I know there's a couple of ways I could do this. In my first email I can see a senario of 1 select plus 100 inserts. Another may be 1 select plus 1 insert. For example; In a table of 3000 rows a user submits a query which returns 100 rows. I could loop through the result se

Re: [SQL] Logging select statements

2003-07-08 Thread Achilleus Mantzios
Thats why people who want entreprise apps must use enterprise frameworks. In J2EE for instance you could use LOG4J which is sorta equivalent of syslog for java. See if there is a logging module for PHP. PgSQL has no clue of who the user is. I dont think delegating this logging task to pgSQL is

Re: [SQL] executing a function

2003-07-08 Thread Matthew Horoschun
Hi Pawan,    CREATE FUNCTION "public"."gettesttab" () RETURNS SETOF public.testtab AS'         select * from TestTab;     'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; You want LANGUAGE 'sql' Cheers Matthew. ---(end of broadcast)---

[SQL] executing a function

2003-07-08 Thread adivi
Hi, i doubt if this should 've gone to the novice group, but it's all sql         i have a function that returns a setof rows from a table testtab :    CREATE FUNCTION "public"."gettesttab" () RETURNS SET

[SQL] Logging select statements

2003-07-08 Thread Rudi Starcevic
Hi, I have an application where user's can view records in a short form with their first select and view a long form with a second select. The first view I term an impression. The second view I term a click. I'd like to log the impression's and click's. I'm wondering which is the most effiecient

Re: [SQL] Datatype conversion help

2003-07-08 Thread Yasir Malik
Yes, Mr. Nachbaur helped me out. Thanks. I don't think I can do to_char(, 'MM-DD-) because the date fields are originally stored as separate integers in my schema (they have to be that way). I still can't understand why the extra space was added after the dash. It just made my life more mis

Re: [SQL] Datatype conversion help

2003-07-08 Thread David Olbersen
Yasir, If this is a date you're playing with, simply use: to_char( , 'MM-DD-' ) to get what you want. -- David Olbersen iGuard Engineer St. Bernard Software 11415 West Bernardo Court San Diego, CA 92127 1-858-676-2277 x2152 > -Original Message- > From: Y

Re: [SQL] Datatype conversion help

2003-07-08 Thread Michael A Nachbaur
http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=functions-formatting.html#FUNCTIONS-FORMATTING-DATETIMEMOD-TABLE See the pattern modifier "FM". From the docs: "FM prefix - fill mode (suppress padding blanks and zeroes)" On Tuesday 08 July 2003 01:28 pm, Yasir Malik wrote: > Than

Re: [SQL] Datatype conversion help

2003-07-08 Thread Yasir Malik
Thank you so much! But my problem is that when I do to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr, '') where mn, dy, and yr are ints, is that the output has a space after the the dash. For example, I get 07- 25- 1994 instead of what I want: 07-25-1994 Thanks, Yasir On

Re: [SQL] Datatype conversion help

2003-07-08 Thread Michael A Nachbaur
You want to use: nachbaur=# select to_char(5, '00'); to_char - 05 (1 row) By using "0", you indicate you want leading zeros. See http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=functions-formatting.html for more information. On Tuesday 08 July 2003 01:07 pm, Yasir

[SQL] Datatype conversion help

2003-07-08 Thread Yasir Malik
Suppose I have an integer between 0 and 99 and I want to covert it to string, and pad leading zeros if neccessary. For example, 1 => 01 10 => 10 I've tried to_char(in_val, '99'), and that returns a string that is two charecters, but there isn't a leading zero incase I have the number 2 as input.

Re: [SQL] Setuid functions

2003-07-08 Thread Joe Conway
Luis Sousa wrote: How can I set a function as setuid ? I take a look at the documetation, on Reference Manual and the only reference I saw to it was on SET SESSION AUTHORIZATION. See: http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=sql-createfunction.html CREATE [ OR REPLACE ] FUNC

[SQL] Setuid functions

2003-07-08 Thread Luis Sousa
Hi all, How can I set a function as setuid ? I take a look at the documetation, on Reference Manual and the only reference I saw to it was on SET SESSION AUTHORIZATION. Thanks in advance. Luis Sousa ---(end of broadcast)--- TIP 4: Don't 'kill -9' t

Re: [SQL] columnar format

2003-07-08 Thread Christoph Haller
> > i would like to ask for the sql statement to the output: > > ITEM DESC Jan Feb Mar Apr ... Sep Total > xx 999 999 999 999 ... 999 9,999 > > where "Jan" column is sum of all "x" items purchased on Jan, "Feb" column as > sum of Feb purchases, and so on up to "Sep", and "