Re: Problem on PostgreSQL (error code, store procedures)

From: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
To: carmen_wai(at)yahoo(dot)com (Carmen Wai)
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Problem on PostgreSQL (error code, store procedures)
Date: 2002-07-10 12:47:30
Message-ID: 200207101047.MAA06942@rodos
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-general pgsql-sql

>
> I would like to know if there are any global variables
> storing the error code or the number of rows affected
> after each execution of the SQL statement.

You did not mention which interface you are using.
In C there are functions available like
extern const char *PQcmdTuples(PGresult *res);
to learn about the rows affected or
extern int PQntuples(PGresult *res);
to learn about the number of rows found (SELECT) or
extern ExecStatusType PQresultStatus(PGresult *res);
to learn about the status of the SQL command.
Unfortunately, there are no error codes at all.
In PL/pgSQL (which I do not use) I've found
GET DIAGNOSTICS variable = ROW_COUNT ;
refer to plpgsql-statements.html

>
> Also, for Postgresql function, I have checked that I
> can only call the function by: select function(parms)
> or by EXECUTE PROCEDURE function(parms) in the trigger
> action. I wonder whether there is any other method for
> calling the function which is similar to the stored
> procedures in the MS SQL server?

I'm afraid NO.

Regards, Christoph

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Klaus Fretter 2002-07-10 17:34:10 error in database migration wizard
Previous Message Dave Page 2002-07-09 15:54:20 Re: FW: small problem with RA to PSQL.

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2002-07-10 12:48:43 Re: static linkage with libpq?
Previous Message Arjen van der Meijden 2002-07-10 12:31:33 Re: Flag for insentive use of Postgres?

Browse pgsql-sql by date

  From Date Subject
Next Message Christoph Haller 2002-07-10 13:00:42 Re: Variables in PSQL
Previous Message Achilleus Mantzios 2002-07-10 12:25:56 Re: Error with DISTINCT and AS keywords