Friday, February 14, 2020

plpgsql_check 1.9 calculates coverage metrics

Small note - I finished support of statement and branch coverage metrics calculations for plpgsql_check

https://github.com/okbob/plpgsql_check/commit/c6f9896ead0a0969db23c3062f1fe7ce5f38029b

Saturday, February 8, 2020

psql and gnuplot

psql from PostgreSQL 12 can produces CSV format. This format is well readable by gnuplot. So anybody can use it together:

\pset format csv
select i, sin(i) from generate_series(0, 6.3, 0.5) g(i) \g |gnuplot -p -e "set datafile separator ','; set key autotitle columnhead; plot '-'with boxes"

    1 +-+---------+-*******--+-----------+----------+-----------+--------+-+   
      +           + *     *******        +          +           +          +   
  0.8 +-+      ******     *     *                              sin *******-+   
      |        *    *     *     *                                          |   
  0.6 +-+      *    *     *     *******                                  +-+   
      |  *******    *     *     *     *                                    |   
  0.4 +-+*     *    *     *     *     *                                  +-+   
      |  *     *    *     *     *     *                                    |   
  0.2 +-+*     *    *     *     *     ******                             +-+   
    0 **********************************************************************   
      |                                    *     *     *     *    *     *  *   
 -0.2 +-+                                  *     *     *     *    *     *+-*   
      |                                    *     *     *     *    *     ****   
 -0.4 +-+                                  *******     *     *    *     *+-+   
      |                                          *     *     *    *     *  |   
 -0.6 +-+                                        *     *     *    *     *+-+   
      |                                          *     *     *    *******  |   
 -0.8 +-+                                        *******     *    *      +-+   
      +           +          +           +          +  *     *  + *        +   
   -1 +-+---------+----------+-----------+----------+--************------+-+   
      0           1          2           3          4           5          6  

postgres=# select i, sin(i) from generate_series(0, 6.3, 0.05) g(i) \g |gnuplot -p -e "set datafile separator ','; set key autotitle columnhead; set terminal dumb enhanced; plot '-'with boxes" 

                                                                               
                                                                               
    1 +-+-------+-*******-+---------+--------+---------+---------+-------+-+   
      +         ************        +        +         +         +         +   
  0.8 +-+     ****************                                 sin *******-+   
      |      ******************                                            |   
  0.6 +-+   ********************                                         +-+   
      |   ************************                                         |   
  0.4 +-+**************************                                      +-+   
      | ****************************                                       |   
  0.2 +******************************                                    +-+   
    0 ***************************************************************    +-+   
      |                              ********************************      |   
 -0.2 +-+                             ******************************     +-+   
      |                                ****************************        |   
 -0.4 +-+                               **************************       +-+   
      |                                  ***********************           |   
 -0.6 +-+                                 *********************          +-+   
      |                                     ******************             |   
 -0.8 +-+                                    ****************            +-+   
      +         +         +         +        + ************      +         +   
   -1 +-+-------+---------+---------+--------+---********--------+-------+-+   
      0         1         2         3        4         5         6         7   
                                                                               

postgres=# select i, sin(i) from generate_series(0, 6.3, 0.05) g(i) \g |gnuplot -p -e "set datafile separator ','; set key autotitle columnhead; set terminal dumb enhanced; plot '-'with lines ls 1" 

                                                                               
                                                                               
    1 +-+-------+-*******-+---------+--------+---------+---------+-------+-+   
      +         ***      ***        +        +         +         +         +   
  0.8 +-+     ***          ***                                 sin *******-+   
      |      **              **                                            |   
  0.6 +-+   *                  *                                         +-+   
      |   **                    **                                         |   
  0.4 +-+**                      **                                      +-+   
      | **                        **                                       |   
  0.2 +**                          **                                    +-+   
    0 **+                           **                              *    +-+   
      |                              **                            **      |   
 -0.2 +-+                             **                          **     +-+   
      |                                 *                        **        |   
 -0.4 +-+                                *                      **       +-+   
      |                                  **                    *           |   
 -0.6 +-+                                 **                 **          +-+   
      |                                     **              **             |   
 -0.8 +-+                                    **           ***            +-+   
      +         +         +         +        + ***     +***      +         +   
   -1 +-+-------+---------+---------+--------+---*******---------+-------+-+   
      0         1         2         3        4         5         6         7 






Friday, February 7, 2020

Moscow PgConf.Russia 2020

Last week I was on Moscow's PgConf.Russia 2020 (Thanks for Oleg Bartunov for invitation). It was interesting and very good event, where I can meet interesting people, where I can see interesting places - like famous building of Moscow Lomonosov State University - with nice guide from PostgresPro.


My presentations

https://pgconf.ru/en/2020/272099
https://pgconf.ru/en/2020/272097

Saturday, December 14, 2019

pspg themes - what you use it?

This year I finish more projects - pspg - there are watch mode, integrated readers from csv and tsv, and vertical cursor and sort on client side.

plpgsql_check can detect some basic sql injection problems and has integrated profiler now. Lot of bug was fixed. These tools works well and I am almost satisfied with their functionality.

Today some lighter topic. I did screenshot of any theme supported by pspg. What theme do you use, or what theme do you prefer?

Thursday, November 21, 2019

Compilation Orafce on CentOS 7 against pgdg repo

if somebody has problem with missing clang like "clang: command not found", then workaround can be running make with variable:

  with_llvm=no make -e

Tuesday, November 19, 2019

using pspg for SQLite

pspg can be used for SQLite too. Not directly, because sqlite client is not too rich. But there are some possibilities:

a) you can use litecli. litecli is able to use pspg

b) generate CSV from sqlite client - this format is well readable for pspg

sqlite3 -csv -header testdb.db 'select * from foo2' | pspg --csv --csv-header=on --double-header

Thank you for tip to Trent W. Buck.

Sunday, October 27, 2019

watch mode for pspg

I released version 2.5.0 of pspg.

Major feature of this release is possibility to bypass psql and take data from Postgres directly (option: -q, --query). Now the pspg can be used like very simple Postgres client. The main benefit of this feature is in relation to new watch mode. The result of query can be refreshed every n seconds (option: -w). It's allow to use the pspg for simple fresh data presentations, for simple monitoring. The refreshing can be stopped/started by pressing space.