pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedFunction executing twice
2+ messages / 2 participants
[nested] [flat]
* Function executing twice
@ 2003-01-30 14:54 Thiago Conti <thiago@nq.com.br>
2003-01-30 15:15 ` Re: Function executing twice Tambet Matiisen <t.matiisen@aprote.ee>
0 siblings, 1 reply; 2+ messages in thread
From: Thiago Conti @ 2003-01-30 14:54 UTC (permalink / raw)
To: pgsql-sql
Hello,
I'm executing a function with this command:
select function_name(aaa,bbb,ccc);
When I do it on PSQL or PGAdmin it works perfectly.
However, on my application the function is executed twice.
Has anybody faced a problem like this?
I'm using PostgreSQL 7.2.3 and ODBC conection.
Thanks
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Function executing twice
2003-01-30 14:54 Function executing twice Thiago Conti <thiago@nq.com.br>
@ 2003-01-30 15:15 ` Tambet Matiisen <t.matiisen@aprote.ee>
0 siblings, 0 replies; 2+ messages in thread
From: Tambet Matiisen @ 2003-01-30 15:15 UTC (permalink / raw)
To: Thiago Conti <thiago@nq.com.br>; pgsql-sql
I think you should first check your application logic, for example print
something out just before calling the function. Then you can easily see, if
the problem is in PostgreSQL or in your application.
I once had similar problem, when I used function as argument to COALESCE.
COALESCE is translated to CASE before evaluating the arguments. For example
COALESCE(id,nextval('id_seq')) becomes CASE WHEN id IS NOT NULL THEN id WHEN
nextval('id_seq') IS NOT NULL THEN nextval('id_seq') ELSE NULL END. As you
can see, when id is null, the sequence id_seq is incremented twice. Solution
was quite simple, I just used CASE directly: CASE WHEN id IS NOT NULL THEN
id ELSE nextval('id_seq') END.
Tambet
----- Original Message -----
From: Thiago Conti
To: pgsql-sql
Sent: Thursday, January 30, 2003 4:54 PM
Subject: [SQL] Function executing twice
Hello,
I'm executing a function with this command:
select function_name(aaa,bbb,ccc);
When I do it on PSQL or PGAdmin it works perfectly.
However, on my application the function is executed twice.
Has anybody faced a problem like this?
I'm using PostgreSQL 7.2.3 and ODBC conection.
Thanks
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-01-30 15:15 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-30 14:54 Function executing twice Thiago Conti <thiago@nq.com.br>
2003-01-30 15:15 ` Tambet Matiisen <t.matiisen@aprote.ee>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox