Re: [SQL] Trigger and function not on speaking terms

2004-08-02 Thread Richard Poole
On Mon, Aug 02, 2004 at 04:20:15PM -0400, Jeff Boes wrote: > It would seem my trigger definition is trying to find fn_foo(), when I > mean for it to call fn_foo(TEXT). Triggers have to be declared to take no arguments; they find the rows on which they operate in magical ways. (For PL/PgSQL trigg

Re: [SQL] Trigger and function not on speaking terms

2004-08-02 Thread Stephan Szabo
On Mon, 2 Aug 2004, Jeff Boes wrote: > Hmm, this is puzzling me: > > create or replace function fn_foo(text) returns trigger as ' > begin ># Do some stuff with $1 > end; > ' language 'plpgsql'; > > CREATE FUNCTION > > create table bar (aaa text); > > CREATE TABLE > > create trigger trg_bar > a

[SQL] Trigger and function not on speaking terms

2004-08-02 Thread Jeff Boes
Hmm, this is puzzling me: create or replace function fn_foo(text) returns trigger as ' begin # Do some stuff with $1 end; ' language 'plpgsql'; CREATE FUNCTION create table bar (aaa text); CREATE TABLE create trigger trg_bar after insert or update on bar execute procedure fn_foo('string'); ERROR:

[SQL] Query execution differences

2004-08-02 Thread Ray Aspeitia
Hello, I am running into some runtime differences that do not seem to make sense and would like some help interpreting the EXPLAIN ANALYZE output. I have run 2 identical queries, one for each company. Company 1 returns 628 records in a time of 674ms and Company 2 returns 73 records in a time o

Re: [SQL] org.postgresql.PG_Stream.ReceiveChar(PG_Stream.java:143)

2004-08-02 Thread Kris Jurka
On Mon, 2 Aug 2004, [iso-8859-1] Smita Marda wrote: > Hi, I have been using SOFIA framework and postgres database as a > backend. i noticed as the database started growing larger.. today > encountered some error while firing a query to save a record. The table > in which i am going to save the r

[SQL] Problems with UNION ALL and ORDER BY

2004-08-02 Thread Kaloyan Iliev Iliev
10x for the replies. We find the problem. It is in our scripts. We use to_char over a date field and then order by this field. So it sort it as text and not as date. I appologize for loosing your time. 10x again. ---(end of broadcast)--- TIP 2: you

Re: [SQL] Problems with UNION ALL and ORDER BY

2004-08-02 Thread Tom Lane
Kaloyan Iliev Iliev <[EMAIL PROTECTED]> writes: > As I say in my previous letter I am using 7.2.3. If you wish I can show > you the query and the result to see for yourself, that there is > something wrong. It just don't order the overall result but the separate > results of the both subqueries.

Re: [SQL] Problems with UNION ALL and ORDER BY

2004-08-02 Thread Gaetano Mendola
Kaloyan Iliev Iliev wrote: Dear friends..., I have the following problem: select . from where UNION ALL select ... from where ORDER BY field1 But the the order by doesn't work properly. It returns the rows of the first query ordered and then appends the rows of the

Re: [SQL] Problems with UNION ALL and ORDER BY

2004-08-02 Thread Tom Lane
Kaloyan Iliev Iliev <[EMAIL PROTECTED]> writes: > I have the following problem: > select > . > from > > where > > UNION ALL > select > ... > from > > where > > ORDER BY field1 > But the the order by doesn't work properly. It returns the rows of the > first query ordere

Re: [SQL] Problems with UNION ALL and ORDER BY

2004-08-02 Thread Kaloyan Iliev Iliev
Dear Tom, As I say in my previous letter I am using 7.2.3. If you wish I can show you the query and the result to see for yourself, that there is something wrong. It just don't order the overall result but the separate results of the both subqueries. Tom Lane wrote: Kaloyan Iliev Iliev <[EMAIL

[SQL] Problems with UNION ALL and ORDER BY

2004-08-02 Thread Kaloyan Iliev Iliev
Hello again, I am using Postgres 7.2.3. If any other details are necessary I will provide them:))) 10x again ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

[SQL] Problems with UNION ALL and ORDER BY

2004-08-02 Thread Kaloyan Iliev Iliev
Dear friends..., I have the following problem: select . from where UNION ALL select ... from where ORDER BY field1 But the the order by doesn't work properly. It returns the rows of the first query ordered and then appends the rows of the second query ordered. But this is

Re: [SQL] How to create an aggregate?

2004-08-02 Thread Ray Aspeitia
So the AGGREGATE function also references parameters like a regular SQL function. Good to know. Figured I'd ask anyway. Thanks for the info Tom, Greg. Ray A. > I also would like to pass the delimiter to the aggregate as a parameter and I am not sure if it can handle that. It can't. You'll nee