"Doug Johnson" <metaphaze@gmail.com> writes:
> In psql I can run a query like this:
> INSERT INTO foo(col1, col2, col3) VALUES (1, 2, 3) RETURNING col1;
> and I get col1 back from the insert.
> Now, when I do that in a C trigger via SPI_exec the SPI_exec succeeds, but I
> can't figure out how to access the RETURNING part.
Works for me; I suspect the problem is in some part of your code that
you didn't show us. Is it really just a plain INSERT/RETURNING (no
possible interference from rules, say)? Are you really only testing the
SPI_exec result code for negative (maybe you forgot to allow
SPI_OK_INSERT_RETURNING as a valid result)?
regards, tom lane