Accessing database notices

I want to be able to see the notices that might be raised after executing SQL. For example, in Postgres, if I issue BEGIN, I might want to read the notice “14:16:07 WARNING: there is already a transaction in progress”. Is there any way to do that currently?

(That notice was just one example.)

Do you know c API to do this?
I could add it to MBS SQL Plugin.

Or maybe a sql query could bring it.

Maybe sqlca structure?

See
https://www.postgresql.org/docs/9.1/static/ecpg-errors.html

That looks more promising for you (and a nice addition to your plugin) than me as I’m not sure how I’d take advantage of that through pure Xojo code.

looks like this could actually already be done
every PQexec call returns a PGResult (see PGResultStatus)
It looks like we’re not doing anything with this particular warning message (PGRES_NONFATAL_ERROR)

Doesn’t strike me as a big change to make these also available

This might also be an idea:

http://www.cybertec.at/exposing-postgresql-server-logs-to-users-via-sql/

Norman, to be clear, this would be a change to the plugin itself, yes?

Maximilian, thanks for that suggestion but that won’t work well for us. I’d rather find a way to access the notices directly anyway.

[quote=322853:@Kem Tekinay]Norman, to be clear, this would be a change to the plugin itself, yes?
[/quote]
It would
It looks like its ignoring this particular response code
But that was a very quick glance over the sources
Seems that this should be available just like any other error message would be (theres no real way to distinguish between errors and warnings like this is)

I’ll file a feature request, thanks.

<https://xojo.com/issue/47501>

such a case is already existing for quite some time: <https://xojo.com/issue/13158>

[quote=322787:@Christian Schmitz]Maybe sqlca structure?
See https://www.postgresql.org/docs/9.1/static/ecpg-errors.html[/quote]

[quote=322792:@Norman Palardy]looks like this could actually already be done
every PQexec call returns a PGResult (see PGResultStatus)
It looks like we’re not doing anything with this particular warning message (PGRES_NONFATAL_ERROR)
Doesn’t strike me as a big change to make these also available[/quote]

the relevant API here is: https://www.postgresql.org/docs/current/static/libpq-notice-processing.html Handling of that is similar to the NOTIFY API. From a PQexec, you would not get that information:

[quote]https://www.postgresql.org/docs/current/static/libpq-exec.html#LIBPQ-PQRESULTSTATUS
A result of status PGRES_NONFATAL_ERROR will never be returned directly by PQexec or other query execution functions; results of this kind are instead passed to the notice processor[/quote]