Re: [SQL] We all are looped on Internet: request + transport = invariant

2007-04-25 Thread Dmitry Turin
Good day, Joe. >> J> How do I see employees in just one department? >> department[id="1"].employee >>; >> department[name="Technical"].employee >>; J> How is that any different or better than a standard SQL SELECT by absence of gasket (php, its library; perl, its library; etc) J> XML is *not* th

Re: Fwd: Re[2]: [SQL] We all are looped on Internet: request + transport = invariant

2007-04-25 Thread Richard Huxton
Don't forget to cc: the list. Dmitry Turin wrote: Good day, Richard. http://sql4.by.ru/site/sql40/en/author/wave_eng.htm RH> example 2 RH> 1. I can see how one flight might follow another, but not contained. Do you RH> not need some new object "flight_chain" or similar? No ! Fork is possible

[SQL] Which function transform x,y to latitude/longitude?

2007-04-25 Thread Nemo Terry
Hi, For example x= 38356.62 y= 42365.19.how to transform it to latitude 1.399948, longitude 193.92644? Which function I could use? I don’t know the algorithm. Initial data is: ("+proj=cass +a=6378137.0 +rf=298.257223563 +lat_0=1.287639n +lon_0=103.8516e +x_0=3 +y_0=3"). Thanks a lot.

Re: [SQL] We all are looped on Internet: request + transport = invariant

2007-04-25 Thread Joe
Hi Dmitry, On Wed, 2007-04-25 at 10:47 +0300, Dmitry Turin wrote: > J> And there's nothing wrong with Perl, PHP, Python and the myriad > J> interface languages. > > I said many times, what is wrong: > applied users can not join sql and perl, can not use libraries, > and can not adjust web-server.

Re: [SQL] plpgsql array looping

2007-04-25 Thread John DeSoi
One problem (unless you intend to only look at every other element) is that you are incrementing idxptr explicitly in your loop. The FOR loop does that for you. This is the reason your output shows only even values. John On Apr 24, 2007, at 4:42 PM, Richard Albright wrote: for i

Re: [SQL] plpgsql array looping

2007-04-25 Thread Richard Albright
yeah i noticed that this morning, it used to be a while loop, for some reason (probably parser related) it keeps giving me an error on the exit when statement in the loop. On Wed, 2007-04-25 at 09:38 -0400, John DeSoi wrote: > One problem (unless you intend to only look at every other element) >

Re: [SQL] Which function transform x,y to latitude/longitude?

2007-04-25 Thread Michael Fuhr
On Wed, Apr 25, 2007 at 05:02:02PM +0800, Nemo Terry wrote: > For example x= 38356.62 y= 42365.19.how to transform it to latitude > 1.399948, longitude 193.92644? Do you mean longitude 103.92644? In what datum are the lat/lon coordinates? Where did you get the transformation in your example? >

Re: [SQL] Query Join Performance

2007-04-25 Thread Richard Huxton
Aaron Bono wrote: Performance tanks with this query - it takes over 120 seconds (that is where I set the timeout). BTW, on our Linux box the full query we run (which adds 3 more tables on the whole operation along with more filtering on the zip table) finishes in under 10 seconds. Problem i

[SQL] sql wrapped plpgsql set returning function

2007-04-25 Thread Richard Albright
I have figured out my looping issue, but am having difficulty wrapping my set returning plpgsql function getmovavgset with a getmovavg sql func when i run the following: select getmovavg(aggarray(trade_date), aggarray(close_price), '2004-01-20', 5) from ( select trade_date, close_price::n

Re: [SQL] sql wrapped plpgsql set returning function

2007-04-25 Thread Tom Lane
Richard Albright <[EMAIL PROTECTED]> writes: > I have figured out my looping issue, but am having difficulty wrapping > my set returning plpgsql function getmovavgset with a getmovavg sql func > when i run the following: Hm, worksforme (see attached trivial example). What PG version are you using

Re: [SQL] sql wrapped plpgsql set returning function

2007-04-25 Thread Richard Albright
It turns out that the from subselect is causing the error in : select getmovavg(aggarray(trade_date), aggarray(close_price), > '2004-01-20', 5) > from > ( select trade_date, close_price::numeric > from quotedata > where symbol='MSFT' > and trade_date > '2004-01-01' >

Re: [SQL] sql wrapped plpgsql set returning function

2007-04-25 Thread Richard Albright
I narrowed it down further. Can someone explain the difference between passing array[...] and passing an array using an aggregate array function into the function? On Wed, 2007-04-25 at 14:45 -0400, Richard Albright wrote: > It turns out that the from subselect is causing the error in : > > sele

Re: [SQL] Query Join Performance

2007-04-25 Thread Aaron Bono
On 4/25/07, Richard Huxton <[EMAIL PROTECTED]> wrote: Aaron Bono wrote: > Performance tanks with this query - it takes over 120 seconds (that is > where > I set the timeout). > BTW, on our Linux box the full query we run (which adds 3 more tables on > the > whole operation along with more filte

Re: [SQL] Query Join Performance

2007-04-25 Thread Tom Lane
"Aaron Bono" <[EMAIL PROTECTED]> writes: > The biggest problem I notice is when I add a join from a child table > (zip_city) to a parent table (zip). I have filtered the child table down to > about 650 records but when I add the join to the parent which has over > 800,000 records, performance tank

Re: [SQL] Query Join Performance

2007-04-25 Thread Aaron Bono
On 4/25/07, Tom Lane <[EMAIL PROTECTED]> wrote: "Aaron Bono" <[EMAIL PROTECTED]> writes: > The biggest problem I notice is when I add a join from a child table > (zip_city) to a parent table (zip). I have filtered the child table down to > about 650 records but when I add the join to the parent

Re: [SQL] Query Join Performance

2007-04-25 Thread Alvaro Herrera
Aaron Bono wrote: > Looks like a vacuum analyze did the trick. Performance is beautiful now. I > should have tried that earlier. > > I thought I had the auto vacuum turned on (PostgreSQL 8.1) but I guess it > doesn't do analyze? > > Anyway, I will schedule a vacuum analyze nightly - it is low

Re: [SQL] Which function transform x,y to latitude/longitude?

2007-04-25 Thread Nemo Terry
I just know the correct data must be longitude 103.926669,latitude0.111827. x,y from Cassini system. Could you give me the source code how you calculate.Thanks a lot! From: Michael Fuhr <[EMAIL PROTECTED]> To: Nemo Terry <[EMAIL PROTECTED]> CC: pgsql-sql@postgresql.org Subject: Re: [SQL] Which

[SQL] Add constraint for number of chars

2007-04-25 Thread PostgreSQL Admin
Hi, This is seemly simple, but I'm @ a loss this early in the morning. It's best explained this way SAMPLE --- id | serial| username | varchar(100)| constraint username >=8 and username <=100 The problem is that it's characters not

Re: [SQL] Add constraint for number of chars

2007-04-25 Thread Tom Lane
PostgreSQL Admin <[EMAIL PROTECTED]> writes: > username | varchar(100)| constraint username >=8 and username <=100 Perhaps you mean "length(username) >= 8" and so on? regards, tom lane ---(end of broadcast)--- TIP 4: Have