pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedInteresting ECPG error
3+ messages / 2 participants
[nested] [flat]
* Interesting ECPG error
@ 2004-06-18 21:11 Owens, Steve <Steve.Owens@xerox.com>
0 siblings, 1 reply; 3+ messages in thread
From: Owens, Steve @ 2004-06-18 21:11 UTC (permalink / raw)
To: pgsql-interfaces
I'm running 7.4.2 and using ECPG's dynamic SQL capabilities to run some pgplsql functions in a database, some of which just insert records into a table. The dynamic SQL statement looks something like this:
"SELECT create_foo(?, ?, ?, ?);"
I'm supplying all 4 arguments, and all 4 arguments have legal values, but ECPG always returns a -220 (too few arguments) in sqlca.sqlcode when running these statements. Other functions that I have are of the form:
"SELECT * from get_foo(?, ?);"
In these cases, with all valid arguments ECPG is returning a 0 (normal return).
Now, I assume that the -220 is due to a "malformed" SELECT statement in the first case, though this seems to work ok in psql. My question is: is there a way to rewrite the failing case above so that it returns a 0 instead of a -220?
Thanks!
This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient(s) please contact the sender by reply e-mail and destroy all copies of the original message. Finally, the recipient should check that this email is authentic and examine it for the presence of viruses. Xerox does perform virus checks but cannot accept liability for any damage caused by any virus transmitted by this email. Thank you.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Interesting ECPG error
@ 2004-06-21 06:38 Michael Meskes <meskes@postgresql.org>
parent: Owens, Steve <Steve.Owens@xerox.com>
0 siblings, 0 replies; 3+ messages in thread
From: Michael Meskes @ 2004-06-21 06:38 UTC (permalink / raw)
To: Owens, Steve <Steve.Owens@xerox.com>; +Cc: pgsql-interfaces
On Fri, Jun 18, 2004 at 05:11:01PM -0400, Owens, Steve wrote:
>
> I'm running 7.4.2 and using ECPG's dynamic SQL capabilities to run some pgplsql functions in a database, some of which just insert records into a table. The dynamic SQL statement looks something like this:
> ...
Could you please run your program with logging enabled? Therefore you
just have to add this at the beginning of your program:
FILE *dbgs;
if ((dbgs = fopen("log", "w")) != NULL) ECPGdebug(1, dbgs);
and an fclose(dbgs) at the end of course. This creates a file named
"log". Then please send me that file. I'd like to see what's going on.
-220 btw is "No Connection" so I assume you mean -202 which is given if
a "?" is left after processing of all variables.
Also could you please send me the .pgc file and your .c file, i.e.
ecpg's output? Preferably in a small test case.
Thanks.
Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Interesting ECPG error
@ 2004-06-28 11:03 Michael Meskes <meskes@postgresql.org>
0 siblings, 0 replies; 3+ messages in thread
From: Michael Meskes @ 2004-06-28 11:03 UTC (permalink / raw)
To: Owens, Steve <Steve.Owens@xerox.com>; +Cc: pgsql-interfaces
On Tue, Jun 22, 2004 at 01:41:58PM -0400, Owens, Steve wrote:
> Ok, I've attached the log file and a tgz file containing a simple test case that duplicates the problem. I took a look down in ECPGexecute and found 3 places where the TOO_FEW_ARGUMENTS error is being returned. If I get a chance, I'll see if I can generate an unstripped version of the ECPG library and get more information.
I think I found it. The reason is that your function does return a
tuple, but your statement offers no variable where this tuple can be
stored. I haven't looked at your function so far, but the log file shows
that PQresultStatus is PGRES_TUPLES_OK. So ecpg tries to read that
variable, which is NULL btw, into a variable but does not find one. Thus
the error message.
Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-06-28 11:03 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-06-18 21:11 Interesting ECPG error Owens, Steve <Steve.Owens@xerox.com>
2004-06-21 06:38 ` Michael Meskes <meskes@postgresql.org>
2004-06-28 11:03 Re: Interesting ECPG error Michael Meskes <meskes@postgresql.org>
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