Re: [SQL] Insane behaviour in 8.3.3

2012-06-15 Thread Raj Mathur (राज माथुर)
robably higher (unless Achilles has an effective backup/restore system), needs to be factored by its probability of occurance. Of course, neither you nor I are in Achilles' shoes, so trying to figure out where they pinch is academic at best. Regards, -- Raj -- Raj Mathur

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 so

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 contin

Re: [SQL] Flatten table using timestamp and source

2012-05-24 Thread Raj Mathur (राज माथुर)
13:01 | 1970-01-01 07:14:01 9 | 1970-01-01 07: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:

Re: [SQL] Flatten table using timestamp and source

2012-05-24 Thread Raj Mathur (राज माथुर)
rce, to look like this: > > Source, Stime, Etime > 1, "2012-05-24 13:00:00","2012-05-24 13:02:00" > 2, "2012-05-24 13:03:00","2012-05-24 13:04:00" > 1, "2012-05-24 13:05:00","2012-05-24 13:06:00" > > Where Et

Re: [SQL] master/detail

2012-05-20 Thread Raj Mathur (राज माथुर)
hink this should be > possible with SQL too... Something like this ought to do it (not tested): select latest.price, latest.price - next.price from (select price from productprice where productid = 1 order by pricedate desc limit 1) latest, (select price from productprice where pr

Re: [SQL] Simple way to get missing number

2012-04-24 Thread Raj Mathur (राज माथुर)
t; | 9 > | > | (7 rows) > | > | Time: 0,246 ms > | test=*# select * from generate_Series(1,10) s left join emi_lu on > | (s=emi_lu.i) where i is null; > | > | s | i > | > | +--- > | > | 4 | > | 7 | > | > | 10 | > | >

Re: [SQL] need help with import

2012-02-15 Thread Raj Mathur (राज माथुर)
+--- 1 | A 2 | B (2 rows) foo=> select * from sp; sid | s -+ 1 | a1 2 | a2 3 | a3 4 | b1 5 | b2 (5 rows) foo=> insert into ms (select mid, sid from mp, sp where (m,s) in (select m, s from t)); INSERT 0 5 foo=> select * from ms;

Re: [SQL] Correlating Asterisk CDRs

2011-12-07 Thread Raj Mathur (राज माथुर)
On Thursday 08 Dec 2011, Scott Marlowe wrote: > 2011/12/7 Raj Mathur (राज माथुर) : > > QUERY

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 table

[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 > comme

Re: [SQL] Correlating Asterisk CDRs

2011-12-07 Thread Raj Mathur (राज माथुर)
7/2011 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 a

[SQL] Correlating Asterisk CDRs

2011-12-07 Thread Raj Mathur (राज माथुर)
ination (dst) and were started on cdr2 after 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

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 (राज माथुर) : > > 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 of

[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

Re: [SQL] simple (?) join

2009-09-24 Thread Raj Mathur
yed. select ol.ol_id,ol.o_id,ol.ol_timestamp from orders o natural join orders_log ol where (ol.o_id,ol.ol_timestamp) in (select o_id,max(ol_timestamp) from orders_log group by o_id); Regards, -- Raju -- Raj Mathurr...@kandalaya.org http://kandalaya.org/ GPG: 78D4 FC67

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: > >> > >>

Re: [SQL] Substring

2009-09-04 Thread Raj Mathur
n't understand why you'd want to search for both 'ab' and 'abc' in the same query, since the first condition is a superset of the second one. Regards, -- Raju -- Raj Mathurr...@kandalaya.org http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0

Re: [SQL] Funtion to clean up strings?

2009-02-17 Thread Raj Mathur
literal > but it still works. Do you know a better or more correct way to reach > the same? > > Perhaps one could find a way with less calls to regexp_replace ? That is what I would have tried too :) The only improvement I can think of is to replace one instance of regex_replac

Re: [SQL] Funtion to clean up strings?

2009-02-12 Thread Raj Mathur
), E'^(?:\\+||00)(.*)', E'\\1') else regexp_replace(p, E'[^0-9]', '', 'g') end) from foo; regexp_replace 0123456789 0123456789 0123456789 +33123456789 +33123456789 (5 rows) That do what you want? (Apologies for the

Re: [SQL] Must I use DISTINCT?

2009-02-05 Thread Raj Mathur
s: foo_entry AS e and foo_link AS a1. I want to > select the the single row from foo_entry with e.eid = 113 but only if > the e.ownid = 66 OR if e.aclid is indirectly linked with 66 via the > foo_link table. Something like this? select * from foo_entry where eid = 113 and ownid in (select a

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',

[SQL] Array iterator

2009-01-27 Thread Raj Mathur
larly 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..

Re: [SQL] Enc: Help to replace caracter

2008-11-14 Thread Raj Mathur
update cadastro.cliente set clie_nmcliente = regexp_replace(clie_nmcliente, '"', '', 'g') where clie_nmcliente like '%"%'; -- delete all ": not tested! You could replace the '' with some other string to replace all &qu

[SQL] Search fields in multiple tables

2008-10-15 Thread Raj Mathur
match on title would rate higher than a match on publisher or on blurb. Regards, -- Raju -- Raj Mathur[EMAIL PROTECTED] http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68 D17F PsyTrance & Chill: http://schizoid.in/ || It is the mind that m

[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
ure pdetail_update_delta() ; Table delta itself looks like this: create table delta ( relationvarchar(32) , -- Table name to which update was made keyval varchar(1024) , -- Key value of the updated record timestamp timestamp without time zone default

[SQL] Dynamic views/permissions

2003-05-31 Thread Raj Mathur
doesn't 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

[SQL] DBD::Pg transaction issues

2003-04-06 Thread Raj Mathur
read 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 --