From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
---|---|
To: | "Haszlakiewicz, Eric" <EHASZLA(at)transunion(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: retrieving function raise messages in ecpg embedded sql code |
Date: | 2012-06-23 00:11:53 |
Message-ID: | 1340410313.16713.57.camel@sussancws0025 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 2012-06-18 at 21:35 +0000, Haszlakiewicz, Eric wrote:
> I'm trying to get some additional information back from a trigger to my embedded SQL
> program, to essentially emulate Informix's way of generating serial values.
> I can get the serial to be generated, but I'm trying to figure out how to get the
> generated value back to my program with minimal changes to the SQL.
Have you already looked at INSERT...RETURNING?
http://www.postgresql.org/docs/9.2/static/sql-insert.html
> I can't figure out how to retrieve the message raised by the trigger. I know it's
> available in some cases, because I see the message when I insert a row through psql,
> but even things like this:
> printf("%s\n", PQerrorMessage(ECPGget_PGconn(mydb)));
>
> return nothing useful. Is there a way to get this information?
Yes, these messages are delivered via notice processing (not to be
confused with LISTEN/NOTIFY):
http://www.postgresql.org/docs/9.2/static/libpq-notice-processing.html
Regards,
Jeff Davis
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Poor | 2012-06-23 06:33:02 | configuring queries for concurrent updates |
Previous Message | Jeff Davis | 2012-06-22 23:07:52 | Re: Feature discussion: Should syntax errors abort a transaction? |