Search Postgresql Archives

Use of ?get diagnostics'?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all

I try to create a function (code at https://pastebin.com/mTs18B90) using 'get diagnostics' to retrieve the number of affected rows. However, it throws

  the following exception was thrown:
SQLSTATE: 42703
column "row_count" does not exist

when I test it with

drop table if exists TEST_EXECUTE_WO_RETURN_LOGGED;
create table TEST_EXECUTE_WO_RETURN_LOGGED(I bigint, C char(2));
commit;
select EXECUTE_WO_RETURN_LOGGED(
I_STATEMENT_TO_EXECUTE => $$insert into TEST_EXECUTE_WO_RETURN_LOGGED(I, C) values (1, 'ab');$$,
    I_LEVEL                 => 'LOG',
    I_REPORT_ERRORS_ONLY    => true
);


If you want to try out the code, be aware that it uses pglogger and pgutils (both on SourceForge maybe not there in the version yet needed, work is ongoing) such that you might want to strip the respective calls.

I created another function using 'get diagnostics' that works - it is part of pglogger. Code snipped

$body$
    declare
        C_LOGGING_LEVEL_PROPERTY_NAME constant text := 'LOGGING_LEVEL';
        V_ROW_COUNT bigint;
    begin
        update PROPERTY
           set PROPERTY_VALUE_STRING = I_LEVEL
         where PROPERTY_NAME = C_LOGGING_LEVEL_PROPERTY_NAME;
        get current diagnostics V_ROW_COUNT = ROW_COUNT;


I did not find the error I am making.

Kind regards

Thiemo

--
S/MIME Public Key: https://oc.gelassene-pferde.biz/index.php/s/eJuAUFONag6ofnH
Signal (Safer than WhatsApp): +49 1578 7723737
Handys: +41 78 947 36 21 | +49 1578 772 37 37
Tox-Id: B7282A9E31D944DDAD1ECC5B33C36AAE80B32D119AB7391D602C937A65E8CA0625C495C5322B

<<attachment: smime.p7s>>


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux