Re: [SQL] Logging select statements

2003-07-09 Thread Achilleus Mantzios
Rudi, i would suggest using a proved framework for logging. Why dont you try to build a function in PHP that acts as syslog. .i.e you have facility (name of your app/page) priority (usually e.g. info in your case) action (what to do with the message, file, apache log, pgsql insert etc..) Then in

Re: [SQL] Datatype conversion help

2003-07-09 Thread Richard Huxton
On Tuesday 08 Jul 2003 10:19 pm, Yasir Malik wrote: > 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 >

Re: [SQL] Logging select statements

2003-07-09 Thread Rudi Starcevic
Achilleus, Thanks - I'll look into that. Cheers Regards Rudi. > Rudi, i would suggest using a proved framework > for logging. > > Why dont you try to build a function in PHP > that acts as syslog. > .i.e you have > facility (name of your app/page) > priority (usually e.g. info in your case) > a

Re: [SQL] max length of sql select statement ?

2003-07-09 Thread markus brosch
On Mon, 2003-07-07 at 18:20, Rod Taylor wrote: > > Could be a solution?! > > The question is - how long could the IN be? > > I'm not sure about IN specifically, but I know you can do: > SELECT * FROM table WHERE col = '<1GB long file>'; > It tends not to be friendly for Ram though :) Hi again!

Re: [SQL] Logging select statements

2003-07-09 Thread Matthew Horoschun
Hi Rudi, You can't trigger on a SELECT, but you could wrap your SQL in a set returning function... http://techdocs.postgresql.org/guides/SetReturningFunctions Here is a rough and ready solution: CREATE TABLE access_log ( id int not null ); CREATE TABLE datatable ( id int not null prim

Re: [SQL] Logging select statements

2003-07-09 Thread Rudi Starcevic
Matthew, Gee thanks .. I just read over Stephan's Set Returning Function last night .. I was trying to see how I could use it. > Hope that is what you were after! Indeed it is. Your 'rough and ready solution' solution is a mighty fine place to begin. Thanks aplenty to you and Achilleus for ta

Re: [SQL] max length of sql select statement ?

2003-07-09 Thread Rod Taylor
> Maybe we can disuss that problem here again?! What exactly means > "max_expr_depth"? Thanks for any help If I'm not mistaken, max_expr_depth is used to catch runaway recursion (view a is select * from b, view b is select * from a). It's a tunable in postgresql.conf. Toss a couple of 0's behind

Re: [SQL] Need help with complex query

2003-07-09 Thread Yasir Malik
Mr. Haller That was what I was exactly looking for. The guys at experts-exchange.com or any other website could come up with that answer. I figured it out without using DISTINCT ON, but the solution was horrendous. I have already turned in my assignment, however. Thank you so much for your help.

Re: [SQL] max length of sql select statement ?

2003-07-09 Thread markus brosch
On Wed, 2003-07-09 at 17:45, Rod Taylor wrote: > > Nobody a better idea? Why is the join of a temporary table (the IN > > paramters) and the original table so slow? Any tricks here? > > Did you index and ANALYZE the temporary table? No! I have to do this "strange" and "long" statement also a vi

Re: [SQL] max length of sql select statement ?

2003-07-09 Thread Rod Taylor
On Wed, 2003-07-09 at 15:51, markus brosch wrote: > On Wed, 2003-07-09 at 17:45, Rod Taylor wrote: > > > Nobody a better idea? Why is the join of a temporary table (the IN > > > paramters) and the original table so slow? Any tricks here? > > > > Did you index and ANALYZE the temporary table? > >

Re: [SQL] Break referential integrity.

2003-07-09 Thread Jan Wieck
Stephan Szabo wrote: On Wed, 2 Jul 2003, Rudi Starcevic wrote: Hi, I know that if you have a trigger and function then drop/replace the function the trigger needs to be drop/replaced too so that it can see the new function. Is it the same for Ref. Integ. on table's too ? If table B's foreign key

[SQL] Home-brewed table syncronization

2003-07-09 Thread Michael A Nachbaur
Hello everyone, While I still have plans to do some more work on RServ, it is apparent to me that I need a more immediate solution. I'm not replicating my entire dataset, but rather just some "summary" tables that are maintained by stored procedures. This means RServ is an iffy proposition at

Re: [SQL] Home-brewed table syncronization

2003-07-09 Thread Cliff Wells
On Wed, 2003-07-09 at 14:14, Michael A Nachbaur wrote: > So, I'm looking at syncronizing 4 tables from one master database to several > child databases. I'm thinking of doing the following with DBD::Multiplex: > > DELETE FROM TableA; > INSERT INTO TableA (..) VALUES (...); > > > on all the

Re: [SQL] Home-brewed table syncronization

2003-07-09 Thread Michael A Nachbaur
On Wednesday 09 July 2003 02:28 pm, Cliff Wells wrote: > On Wed, 2003-07-09 at 14:14, Michael A Nachbaur wrote: > > So, I'm looking at syncronizing 4 tables from one master database to > > several child databases. I'm thinking of doing the following with > > DBD::Multiplex: > > > > DELETE FROM Tabl

Re: [SQL] Home-brewed table syncronization

2003-07-09 Thread Jason Earl
Michael A Nachbaur <[EMAIL PROTECTED]> writes: > On Wednesday 09 July 2003 02:28 pm, Cliff Wells wrote: >> On Wed, 2003-07-09 at 14:14, Michael A Nachbaur wrote: >> > So, I'm looking at syncronizing 4 tables from one master database to >> > several child databases. I'm thinking of doing the follow

Re: [SQL] Datatype conversion help

2003-07-09 Thread Dmitry Tkach
What about lpad? select lpad (7, 2, 0) || '-' || lpad (9, 2, '0') || '-2003'; ?column? 07-09-2003 (1 row) I hope, it helps... Dima Yasir Malik wrote: Thank you so much! But my problem is that when I do to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr, '')

Re: [SQL] Datatype conversion help

2003-07-09 Thread Yasir Malik
I used trim and here's what I came up with: to_date(trim(to_char(yr, '') || trim(to_char(mn, '00')) || trim(to_char(dy, '00'))), 'MMDD') Apparently to_char adds a space to the charecter you are casting. Yasir On Wed, 9 Jul 2003, Dmitry Tkach wrote: > Date: Wed, 09 Jul 2003 18:40:37 -0400

Re: [SQL] Datatype conversion help

2003-07-09 Thread Dmitry Tkach
Yasir Malik wrote: I used trim and here's what I came up with: to_date(trim(to_char(yr, '') || trim(to_char(mn, '00')) || trim(to_char(dy, '00'))), 'MMDD') Apparently to_char adds a space to the charecter you are casting. I know :-) And lpad doesn't - that's why I suggested it :-) Dima

Re: [SQL] Datatype conversion help

2003-07-09 Thread Yasir Malik
I will surely use your suggestion in my future programs. Thanks, Yasir On Wed, 9 Jul 2003, Dmitry Tkach wrote: > Date: Wed, 09 Jul 2003 18:51:48 -0400 > From: Dmitry Tkach <[EMAIL PROTECTED]> > To: Yasir Malik <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > Subject: Re: [SQL] Datatype conversion he

Re: [SQL] create view error

2003-07-09 Thread mila boldareva
Hi, Gary! > CREATE > create view loco_dets as > select * from locos l > left outer join > (select * from lclass) lc on lc.lcid = l.lclass > left outer join (*) (select lnumber from lnumbers) ln on ln.lnid = l.lid and ln.lncurrent > = true > left outer join >

[SQL] help yourself by helping others

2003-07-09 Thread Ali Adams
Dear All,   I am new to Relational Databases and SQL and my background in ODBs is clouding my way to solving what seems to be a simple problem. I am sure many of you have met it many times.   OK, I have a table as follows:     ID Machine   Date Withdrawals 1  1  01/

[SQL] max length of sql select statement ?

2003-07-09 Thread markus brosch
Hi All! I was searching the archive and was wondering why nobody asked this strange question (or I've not found it?): "What is the max allowed length of a sql statement or query?" I want to combine hundrets or thousands 'OR' within a select statement. Possible or not? cheers Markus ---

Re: [SQL] sort for ranking

2003-07-09 Thread Henshall, Stuart - TNP Southwest
Title: RE: [SQL] sort for ranking Could you do something like the following: SELECT sum_user,(SELECT count(sum_user)+1 FROM tbl_sums AS t WHERE t.sum_user>tbl_sums.sum_user) AS ranking FROM tbl_sums ORDER BY ranking hth, - Stuart P.S. Sorry about format change, the disclaimer adder forces it

[SQL] Recursive request ...

2003-07-09 Thread Benoît Bournon
I have to make a function that returns a tree with title and link of a table. Recursively, a information depends on a parent information. It is to organise a menu with parent dependance. How is it possible and faster ? in C ? pl/pgsql or other ? ---(end of broadcast)--

Re: [SQL] Home-brewed table syncronization

2003-07-09 Thread Raj Mathur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > "Michael" == Michael A Nachbaur writes: Michael> On Wednesday 09 July 2003 02:28 pm, Cliff Wells wrote: >> On Wed, 2003-07-09 at 14:14, Michael A Nachbaur wrote: > So, >> I'm looking at syncronizing 4 tables from one master database

[SQL] substr_count

2003-07-09 Thread Tom Rochester
Hey all, I would like to achive something along the lines of: SELECT field FROM table WHERE field ILIKE '$searchterm' ORDER BY substr_count(field, '$searchterm'); Of course the substr_count function does not exist. Is there anyway to do this? I had a thought char_count(replace(field, !$search

[SQL] trigger proceedures in sql

2003-07-09 Thread adivi
hi,     can trigger proceedures ( procedures to be executed from within a trigger )         not be written in sql.     i was looking for examples and can find proceedures in 'c' only.   regards-adivi

Re: [SQL] Datatype conversion help

2003-07-09 Thread listrec
I tried select to_date(substring(to_char(yr,'0009'),2,4)||substring(to_char(mn,'09'),2,2)|| substring(to_char(dy,'09'),2,4),'MMDD'); which works fine Detlef -Ursprungliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Auftrag von Dmitry Tkach Gesendet: Donnerstag,