Re: ODBC - Retrieving info messages - RAISE NOTICE

From: "Inoue, Hiroshi" <h-inoue(at)dream(dot)email(dot)ne(dot)jp>
To: Clemens Ladisch <clemens(at)ladisch(dot)de>, wolfgang(dot)apolinarski(at)googlemail(dot)com
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: ODBC - Retrieving info messages - RAISE NOTICE
Date: 2018-02-13 22:17:38
Message-ID: 437ead79-91df-a257-162e-bc5bec9abbc5@dream.email.ne.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi,

On 2018/02/10 19:18, Clemens Ladisch wrote:
> Wolfgang Apolinarski wrote:
>> only the last message ("3") is retrieved, when a statement like
>> DO $$
>> RAISE NOTICE '1';
>> RAISE NOTICE '2';
>> RAISE NOTICE '3';
>> END$$;
>> is executed.
> When receiving a notice from libpq, the driver calls QR_set_notice(),
> which replaces any previous notice. To get all notices separated with
> a semicolon, try using QR_add_notice() instead (see the patch below).

I would take care of the patch.

Thanks.
Hiroshi Inoue

>
>> Maybe this is a general constraint when using ODBC
> In theory, the ODBC API (SQLGetDiagRec) would allow any number of
> messages.
>
>
> Regards,
> Clemens
>
>
> --- psqlodbc.orig/connection.c
> +++ psqlodbc/connection.c
> @@ -894,7 +894,7 @@ handle_pgres_error(ConnectionClass *self
> {
> if (QR_command_successful(res))
> QR_set_rstatus(res, PORES_NONFATAL_ERROR); /* notice or warning */
> - QR_set_notice(res, errmsg); /* will dup this string */
> + QR_add_notice(res, errmsg); /* will dup this string */
> }
> goto cleanup;
> }

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Inoue, Hiroshi 2018-02-14 00:25:22 Re: Patch for an encoding bug in the derive_locale_encoding function
Previous Message Clemens Ladisch 2018-02-13 18:07:51 Re: PostgreSQL) How to use Bind Variable with ODBC Driver V10?