Re: [SQL] Does Postgresql have a similar pseudo-column ROWNUM as

2005-05-18 Thread Ragnar Hafstað
On Tue, 2005-05-17 at 23:16 -0300, Alain wrote: Ragnar Hafstað escreveu: [how to solve the get next 100 records problem] BUT, I think that this is close to a final solution, I made some preliminary test ok. Please tell me what you think about this. Fisrt let's state that I am reading

[SQL] Changed to: how to solve the get next 100 records problem

2005-05-18 Thread Alain
Hi Ragnar (and others), I found something that is both fast and simple (program side): Allways assuming that: pkey is a primary key and skey is a sort key, and there exists an index on (skey,pkey) first select is select ... from tab ORDER by skey,pkey LIMIT 100; subsequent selects are (select ...

[SQL] Meaning of ERROR: tuple concurrently updated

2005-05-18 Thread KÖPFERL Robert
Hi, I have got some kind of FIFO-queue table. New records are inserted and the oldest are DELETEd. Thus I run VACUUM ANALYZE; every night by cron. However I keep getting ERROR: tuple concurrently updated My research lead me to the point that this is VACUUM tothether with the INSERTs being

Re: [SQL] Meaning of ERROR: tuple concurrently updated

2005-05-18 Thread Tom Lane
=?ISO-8859-1?Q?K=D6PFERL_Robert?= [EMAIL PROTECTED] writes: Thus I run VACUUM ANALYZE; every night by cron. However I keep getting ERROR: tuple concurrently updated Have you got other processes also doing VACUUM ANALYZE? The only known reason for this to happen is that two processes

[SQL] Turning column into *sorted* array?

2005-05-18 Thread Felix E. Klee
Suppose I have a table containing a column with integer values: CREATE TABLE some_table (x int NOT NULL); INSERT INTO some_table values(1); INSERT INTO some_table values(5); INSERT INTO some_table values(3); Also, there is a view to that table (probably superfluous here, but it's in the actual

[SQL] Help with views/rules...

2005-05-18 Thread Peter Bense
I've got this funky problem. Basically I have a table that contains: afl=# \d tblpis_survey_receipt Table public.tblpis_survey_receipt Column | Type | Modifiers

Re: [SQL] Changed to: how to solve the get next 100 records problem

2005-05-18 Thread Ragnar Hafstað
On Wed, 2005-05-18 at 12:42 -0300, Alain wrote: I found something that is both fast and simple (program side): ... subsequent selects are (select ... from tab WHERE skey=skey_last AND pkeypkey_last ORDER BY skey,pkey LIMIT 100) UNION (select ... from tab WHERE

Re: [SQL] Changed to: how to solve the get next 100 records problem

2005-05-18 Thread PFC
The only strange thing is that without the 3rd order by, the order is wrong. I didn't expect it because each select is created ordered. Is it expected that UNION mixes it all up? (using postgre 7.4.1) That's because UNION removes duplicates, which it will probably doing using a hash

Re: [SQL] Turning column into *sorted* array?

2005-05-18 Thread PFC
SELECT array_accum(x) FROM (SELECT * FROM some_view ORDER BY x) AS tmp; If you're using integers, you could use the int_array_accum or something from the intarray module which is a lot faster. I believe intarray also has a function for sorting integer arrays... BTW, the best alternative (in

Re: [SQL] Turning column into *sorted* array?

2005-05-18 Thread Felix E. Klee
At Wed, 18 May 2005 19:54:08 +0200, PFC wrote: SELECT array_accum(x) FROM (SELECT * FROM some_view ORDER BY x) AS tmp; If you're using integers, you could use the int_array_accum or something from the intarray module which is a lot faster. I believe intarray also has a function for

Re: [SQL] Does Postgresql have a similar pseudo-column ROWNUM as

2005-05-18 Thread Chris Browne
[EMAIL PROTECTED] (Alain) writes: Andrew Sullivan escreveu: On Thu, May 12, 2005 at 01:07:00PM -0600, [EMAIL PROTECTED] wrote: Does Postgresql have a similar pseudo-column ROWNUM as Oracle? If so, we can write the following query: No. What is the purpose of your query? You could use ORDER BY

Re: [SQL] Does Postgresql have a similar pseudo-column ROWNUM as

2005-05-18 Thread Sean Davis
On May 18, 2005, at 3:52 PM, Chris Browne wrote: [EMAIL PROTECTED] (Alain) writes: Andrew Sullivan escreveu: On Thu, May 12, 2005 at 01:07:00PM -0600, [EMAIL PROTECTED] wrote: Does Postgresql have a similar pseudo-column ROWNUM as Oracle? If so, we can write the following query: No. What is the

[SQL] postgre variable

2005-05-18 Thread bandeng
hello all, i want to make dynamic sql query like this select * from tb_cust where name='erick' and age='20' to select * from tb_cust $1 i have tried but error comeup any suggestion? thanks Ricky -- Gutten Aben Sugeng Sonten, Jangane Kurang Santen bandeng