stats_ext_psql_output.txt
text/plain
Filename: stats_ext_psql_output.txt
Type: text/plain
Part: 1
$ psql postgres
psql (13.0)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
postgres=# create function check_estimated_rows(text) returns table (estimated int, actual int)
postgres-# language plpgsql as
postgres-# $$
postgres$# declare
postgres$# ln text;
postgres$# tmp text[];
postgres$# first_row bool := true;
postgres$# begin
postgres$# for ln in
postgres$# execute format('explain analyze %s', $1)
postgres$# loop
postgres$# if first_row then
postgres$# first_row := false;
postgres$# tmp := regexp_match(ln, 'rows=(\d*) .* rows=(\d*)');
postgres$# return query select tmp[1]::int, tmp[2]::int;
postgres$# end if;
postgres$# end loop;
postgres$# end;
postgres$# $$;
CREATE FUNCTION
postgres=# CREATE STATISTICS tst;
ERROR: syntax error at or near ";"
LINE 1: CREATE STATISTICS tst;
^
postgres=# CREATE STATISTICS tst ON a, b;
ERROR: syntax error at or near ";"
LINE 1: CREATE STATISTICS tst ON a, b;
^
postgres=# CREATE STATISTICS tst FROM sometab;
ERROR: syntax error at or near "FROM"
LINE 1: CREATE STATISTICS tst FROM sometab;
^
postgres=# CREATE STATISTICS tst ON a, b FROM nonexistent;
ERROR: relation "nonexistent" does not exist
postgres=# CREATE STATISTICS tst ON a, b FROM pg_class;
ERROR: column "a" does not exist
postgres=# CREATE STATISTICS tst ON relname, relname, relnatts FROM pg_class;
ERROR: duplicate column name in statistics definition
postgres=# CREATE STATISTICS tst ON relnatts + relpages FROM pg_class;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.