Re: BUG #16670: pgstattuple ERROR: relation "sql_implementation_info" does not exist

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mrechte(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16670: pgstattuple ERROR: relation "sql_implementation_info" does not exist
Date: 2020-10-14 14:38:37
Message-ID: 3599891.1602686317@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> # select tablename,
> (pgstattuple_approx(tablename::regclass)).approx_free_space from pg_tables
> where schemaname = 'public' and
> (pgstattuple_approx(tablename::regclass)).approx_free_percent > 10;
> ERROR: relation "sql_implementation_info" does not exist

This is not a bug. We don't guarantee anything about the evaluation
order of WHERE clauses. Even if we did, this query has got bugs of
its own: it will fail on tablenames that would require quoting,
such as names containing spaces, dots, uppercase letters, etc.

You could write

(quote_ident(schemaname)||'.'||quote_ident(tablename))::regclass

to avoid both of those issues. There are still going to be some race
condition problems around just-dropped tables, though.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2020-10-14 19:08:06 Re: BUG #16663: DROP INDEX did not free up disk space: idle connection hold file marked as deleted
Previous Message PG Bug reporting form 2020-10-14 12:58:02 BUG #16670: pgstattuple ERROR: relation "sql_implementation_info" does not exist