Re: [SQL] Insane behaviour in 8.3.3

2012-06-15 Thread Raj Mathur (राज माथुर)
, neither you nor I are in Achilles' shoes, so trying to figure out where they pinch is academic at best. Regards, -- Raj -- Raj Mathur || r...@kandalaya.org || GPG: http://otheronepercent.blogspot.com || http://kandalaya.org || CC68 It is the mind that moves

Re: [SQL] Flatten table using timestamp and source

2012-05-25 Thread Raj Mathur (राज माथुर)
On Friday 25 May 2012, Raj Mathur (राज माथुर) wrote: On Thursday 24 May 2012, Elrich Marx wrote: If source changes, in this case from 1 to 2, then etime would be the last value of stime for source =1; So for source 1 it starts at stime 13:00 and continues till 13:02 (etime

Re: [SQL] Flatten table using timestamp and source

2012-05-25 Thread Raj Mathur (राज माथुर)
On Saturday 26 May 2012, Raj Mathur (राज माथुर) wrote: On Friday 25 May 2012, Raj Mathur (राज माथुर) wrote: On Thursday 24 May 2012, Elrich Marx wrote: If source changes, in this case from 1 to 2, then etime would be the last value of stime for source =1; So for source 1 it starts

Re: [SQL] Flatten table using timestamp and source

2012-05-24 Thread Raj Mathur (राज माथुर)
:05:00,2012-05-24 13:06:00 Where Etime is the last Stime for the same source. How do you figure out that the Etime for (1, 13:00:00) is (1, 13:02:00) and not (1, 13:01:00)? Regards, -- Raj -- Raj Mathur || r...@kandalaya.org || GPG: http

Re: [SQL] Flatten table using timestamp and source

2012-05-24 Thread Raj Mathur (राज माथुर)
:15:01 | 1970-01-01 07:17:01 Regards, -- Raj -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Raj Mathur (??? ?) Sent: 24 May 2012 01:59 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] Flatten table using timestamp

Re: [SQL] master/detail

2012-05-20 Thread Raj Mathur (राज माथुर)
, latest.price - next.price from (select price from productprice where productid = 1 order by pricedate desc limit 1) latest, (select price from productprice where productid = 1 order by pricedate desc limit 2 offset 1) next; Regards, -- Raj -- Raj Mathur || r

Re: [SQL] Simple way to get missing number

2012-04-24 Thread Raj Mathur (राज माथुर)
| i | | +--- | | 4 | | 7 | | | 10 | | | (3 rows) Nice one, but curious about how would this perform if the numbers in question extended into 7 figures or more? Regards, -- Raj -- Raj Mathur || r...@kandalaya.org || GPG: http

Re: [SQL] need help with import

2012-02-15 Thread Raj Mathur (राज माथुर)
into ms (select mid, sid from mp, sp where (m,s) in (select m, s from t)); INSERT 0 5 foo= select * from ms; mid | sid -+- 1 | 1 1 | 2 1 | 3 2 | 4 2 | 5 (5 rows) foo= Regards, -- Raj -- Raj Mathur || r...@kandalaya.org || GPG: http

[SQL] Correlating Asterisk CDRs

2011-12-07 Thread Raj Mathur (राज माथुर)
they were started on cdr. cdr2.dst is the same as cdr.dst but with a 3-character prefix. Regards, -- Raj -- Raj Mathur || r...@kandalaya.org || GPG: http://otheronepercent.blogspot.com || http://kandalaya.org || CC68 It is the mind that moves || http

Re: [SQL] Correlating Asterisk CDRs

2011-12-07 Thread Raj Mathur (राज माथुर)
15:34, Raj Mathur (राज माथुर) wrote: I'm trying to correlate Call Data Records (CDRs) from two Asterisk servers, one of which uses the other for telephony. The data is in the tables cdr and cdr2. With some indexes, the query and explain result are: explain analyse select cdr.calldate

[SOLVED] Re: [SQL] Correlating Asterisk CDRs

2011-12-07 Thread Raj Mathur (राज माथुर)
On Wednesday 07 Dec 2011, Raj Mathur (राज माथुर) wrote: On Wednesday 07 Dec 2011, Julien Cigar wrote: Try to raise work_mem Odd, I tried adding work_mem=50MB / 256MB / 1024MB into postgres.conf and the times actually went up to over 12 seconds. Leaving it commented results in the 4-second

Re: [SQL] Correlating Asterisk CDRs

2011-12-07 Thread Raj Mathur (राज माथुर)
On Wednesday 07 Dec 2011, Brent Dombrowski wrote: On Dec 7, 2011, at 6:34 AM, Raj Mathur (राज माथुर) wrote: I'm trying to correlate Call Data Records (CDRs) from two Asterisk servers, one of which uses the other for telephony. The data is in the tables cdr and cdr2. With some indexes

Re: [SQL] Correlating Asterisk CDRs

2011-12-07 Thread Raj Mathur (राज माथुर)
On Thursday 08 Dec 2011, Scott Marlowe wrote: 2011/12/7 Raj Mathur (राज माथुर) r...@linux-delhi.org: QUERY PLAN

[SQL] Generic design: char vs varchar primary keys

2011-08-03 Thread Raj Mathur (राज माथुर)
have a slight edge, in general) - Any other issue Regards, -- Raj -- Raj Mathurr...@kandalaya.org http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68 D17F PsyTrance Chill: http://schizoid.in/ || It is the mind that moves -- Sent via pgsql-sql

Re: [SQL] Generic design: char vs varchar primary keys

2011-08-03 Thread Raj Mathur (राज माथुर)
On Thursday 04 Aug 2011, Josh Kupershmidt wrote: 2011/8/3 Raj Mathur (राज माथुर) r...@linux-delhi.org: Can you point me to any pages that explain the difference between using, say CHAR(8) vs VARCHAR(8) as the primary key for a table? Is there any impact on the database in terms

Re: [SQL] Substring

2009-09-04 Thread Raj Mathur
condition is a superset of the second one. Regards, -- Raju -- Raj Mathurr...@kandalaya.org http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68 D17F PsyTrance Chill: http://schizoid.in/ || It is the mind that moves -- Sent via pgsql-sql

Re: [SQL] Substring

2009-09-04 Thread Raj Mathur
On Saturday 05 Sep 2009, Frank Bax wrote: Raj Mathur wrote: On Saturday 05 Sep 2009, bilal ghayyad wrote: I have an sql script function that take one text parameter funct (text), what I need to do is the following: If the parameter name is string and its value was for example abcd

Re: [SQL] Funtion to clean up strings?

2009-02-17 Thread Raj Mathur
by any means, so someone else may have a faster or more elegant solution. Regards, -- Raju -- Raj Mathurr...@kandalaya.org http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68 D17F PsyTrance Chill: http://schizoid.in/ || It is the mind that moves

Re: [SQL] Funtion to clean up strings?

2009-02-12 Thread Raj Mathur
for the wrapped lines.) Regards, -- Raju -- Raj Mathurr...@kandalaya.org http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68 D17F PsyTrance Chill: http://schizoid.in/ || It is the mind that moves -- Sent via pgsql-sql mailing list (pgsql-sql

Re: [SQL] Array iterator

2009-02-05 Thread Raj Mathur
On Tuesday 27 Jan 2009, Achilleas Mantzios wrote: Στις Tuesday 27 January 2009 14:40:29 ο/η Raj Mathur έγραψε: select regexp_split_to_array('string with tokens', '[^A-Za-z0-9]'); maybe select regexp_split_to_table('string with tokens', '[^A-Za-z0-9]'); would help? That did the job, thanks

Re: [SQL] Must I use DISTINCT?

2009-02-05 Thread Raj Mathur
with 66 via the foo_link table. Something like this? select * from foo_entry where eid = 113 and ownid in (select a from foo_link where a=66 or b=66); Regards, -- Raju -- Raj Mathurr...@kandalaya.org http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968

[SQL] Array iterator

2009-01-27 Thread Raj Mathur
efficient or effective, but serves this specific purpose). Have got as far as: select regexp_split_to_array('string with tokens', '[^A-Za-z0-9]'); Can one now process the resulting array in a single shot within SQL itself? Regards, -- Raju -- Raj Mathurr...@kandalaya.org http

Re: [SQL] Enc: Help to replace caracter

2008-11-14 Thread Raj Mathur
with that string. It may be quicker to edit an ASCII dump of the database and reload it if you want to do the same replacement in multiple fields in multiple tables. Regards, -- Raju -- Raj Mathur[EMAIL PROTECTED] http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0DD5

[SQL] For each key, find row with highest value of other field

2008-10-03 Thread Raj Mathur
marked with a (*) out of these without doing a join? I.e. I wish to find the row with the highest Date for each Key and use the Value from that. Regards, -- Raju -- Raj Mathur[EMAIL PROTECTED] http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68

Re: [SQL] Home-brewed table syncronization

2003-07-09 Thread Raj Mathur
, timestamp ) ) ; Not much experienced with PgSQL, so would appreciate any tips the masters can give for improving the plpgsql code. However, it works for me as it is at the moment. You are free to use this code under the terms of the GNU GPL. Regards, - -- Raju - -- Raj Mathur

[SQL] Dynamic views/permissions

2003-05-31 Thread Raj Mathur
return any rows. Is what I'm trying not possible at all, or am I just trying to implement it wrong? Regards, -- Raju -- Raj Mathur[EMAIL PROTECTED] http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68 D17F It is the mind

[SQL] DBD::Pg transaction issues

2003-04-06 Thread Raj Mathur
existing record update values in existing record rewrite record else if write failed due to missing reference ignore record else mark file as bad if file not bad commit else rollback Hope this is the right list to be asking on. Regards, -- Raju -- Raj