Thread: BUG #16670: pgstattuple ERROR: relation "sql_implementation_info" does not exist
BUG #16670: pgstattuple ERROR: relation "sql_implementation_info" does not exist
From
PG Bug reporting form
Date:
The following bug has been logged on the website: Bug reference: 16670 Logged by: Marc Rechté Email address: mrechte@gmail.com PostgreSQL version: 13.0 Operating system: CentOS8 Description: Hello, I get an error with pgstattuple extension. On PG13.0: # 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 On PG12.3: # 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_packages" does not exist Note that the where clause on approx_free_percent is the error cause. Thanks
Re: BUG #16670: pgstattuple ERROR: relation "sql_implementation_info" does not exist
From
Tom Lane
Date:
PG Bug reporting form <noreply@postgresql.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