pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: mrechte@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16670: pgstattuple ERROR: relation "sql_implementation_info" does not exist
Date: Wed, 14 Oct 2020 10:38:37 -0400
Message-ID: <3599891.1602686317@sss.pgh.pa.us> (raw)
In-Reply-To: <16670-4aa3d62f20dd7754@postgresql.org>
References: <16670-4aa3d62f20dd7754@postgresql.org>

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





view thread (2+ messages)

Message-ID: <3599891.1602686317@sss.pgh.pa.us>
Permalink:  ../3599891.1602686317@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3599891.1602686317@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mrechte@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16670: pgstattuple ERROR: relation "sql_implementation_info" does not exist
  In-Reply-To: <3599891.1602686317@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox