Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notices limited to the last 50 ones #1166

Open
adrian-maurin opened this issue Apr 6, 2020 · 1 comment
Open

Notices limited to the last 50 ones #1166

adrian-maurin opened this issue Apr 6, 2020 · 1 comment

Comments

@adrian-maurin
Copy link

@adrian-maurin adrian-maurin commented Apr 6, 2020

Description

Given the following call

BEGIN;

 CREATE FUNCTION count_to_hundred() RETURNS VOID AS
 $_$
 BEGIN 
     FOR i IN 1..100
     LOOP
         RAISE NOTICE '%', i;
     END LOOP;

     RETURN;
 END;
 $_$
 LANGUAGE plpgsql;


 SELECT count_to_hundred();

 ROLLBACK;

You would expect NOTICE: XXX to be printed from 1 to 100, but it start from 51 and ends at 100.

Your environment

$ uname -srvom
Linux 3.16.0-9-amd64 #1 SMP Debian 3.16.68-2 (2019-06-17) x86_64 GNU/Linux

$ pgcli --version
Version: 2.2.0

$ pip3 freeze
cli-helpers==1.2.1
click==7.1.1
configobj==5.0.6
humanize==2.2.0
pgcli==2.2.0
pgspecial==1.11.9
prompt-toolkit==2.0.10
psycopg2==2.8.5
Pygments==2.6.1
setproctitle==1.1.10
six==1.14.0
sqlparse==0.3.1
tabulate==0.8.7
terminaltables==3.1.0
wcwidth==0.1.9

From my understanding it might come from psycopg2 limiting the number of notices:
https://www.psycopg.org/docs/connection.html#connection.notices

There is a workaround that if connection.notices is overriden, is it possible to have more than 50 in pgcli then?

@amjith
Copy link
Member

@amjith amjith commented Apr 20, 2020

Thank you for researching this to find the limitation. I hadn't run into this limitation myself.

I'm happy to accept a PR if you're willing to take a stab at it.

Relevant code:
https://github.com/dbcli/pgcli/blob/master/pgcli/pgexecute.py#L262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.