From: | "Haszlakiewicz, Eric" <EHASZLA(at)transunion(dot)com> |
---|---|
To: | Jeff Davis <pgsql(at)j-davis(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-25 14:59:06 |
Message-ID: | 4EB74494E20A13478F64930FDE244D6402671069@CHO3WUC9MBX11.corp.transunion.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> -----Original Message-----
> From: Jeff Davis [mailto:pgsql(at)j-davis(dot)com]
>
> 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
Yes, I've started modifying things to use that, but I'd like to avoid doing
that so I can share the same code between postgresql and informix builds.
> > 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
That looks like exactly what I'm looking for, I'll try it out. Thanks!
eric
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-06-25 15:07:03 | Re: 31.11. Notice Processing - associating notices with calls |
Previous Message | Eduardo Morras | 2012-06-25 14:34:11 | Re: UFS2 Snapshots and Postgres |