Giter VIP home page Giter VIP logo

Comments (3)

Melkij avatar Melkij commented on September 13, 2024 1

Should be fixed now

from pgcompacttable.

Melkij avatar Melkij commented on September 13, 2024

Yeah, I observed such error yesterday. Will fix.

The query itself looks correct, but the postgresql query planner moved the cast to regclass to the join condition. Therefore, it may receive an attempt to search for a knowingly non-existent object. pg_toast_5987783_index is part of postgresql TOAST system, but should be in special schema pg_toast, not in public.

But to be sure it's the same problem, please say:

  • what version of postgresql are you using
  • this query gives an error? please post explain (just explain, without explain analize)
  • does this query give an error if you uncomment OFFSET 0?
SELECT
            indexname, indexdef,
            pg_catalog.pg_relation_size(indexoid) as idxsize
        FROM (
            SELECT
                indexname, indexdef,
                (quote_ident(schemaname) || '.' || quote_ident(indexname))::regclass AS indexoid
            FROM pg_catalog.pg_indexes
            WHERE
                schemaname = 'public' AND
                tablename = 'user_subscriptions'/* OFFSET 0*/
        ) AS sq
        LEFT JOIN pg_catalog.pg_constraint ON
            conindid = indexoid AND contype IN ('p', 'u', 'x')
        ORDER BY idxsize

from pgcompacttable.

Skryabind avatar Skryabind commented on September 13, 2024

@Melkij
Server version PostgreSQL 13.2
This query gives an error. This is the explain:

                                                                        QUERY PLAN                                                                         
------------------------------------------------------------------------------------------------------------------------------------------------------------
 Sort  (cost=39.23..39.24 rows=1 width=104)
   Sort Key: (pg_relation_size((((quote_ident((n.nspname)::text) || '.'::text) || quote_ident((i.relname)::text)))::regclass, 'main'::text))
   ->  Merge Join  (cost=4.84..39.22 rows=1 width=104)
         Merge Cond: (n.oid = c.relnamespace)
         Join Filter: (x.indexrelid = i.oid)
         ->  Nested Loop Left Join  (cost=0.27..1868.52 rows=453 width=136)
               Join Filter: (pg_constraint.conindid = ((((quote_ident((n.nspname)::text) || '.'::text) || quote_ident((i.relname)::text)))::regclass)::oid)
               ->  Nested Loop  (cost=0.27..83.70 rows=453 width=136)
                     ->  Index Scan using pg_namespace_oid_index on pg_namespace n  (cost=0.27..31.03 rows=1 width=68)
                           Filter: (nspname = 'public'::name)
                     ->  Seq Scan on pg_class i  (cost=0.00..48.14 rows=453 width=72)
                           Filter: (relkind = ANY ('{i,I}'::"char"[]))
               ->  Materialize  (cost=0.00..18.43 rows=120 width=4)
                     ->  Seq Scan on pg_constraint  (cost=0.00..17.83 rows=120 width=4)
                           Filter: (contype = ANY ('{p,u,x}'::"char"[]))
         ->  Materialize  (cost=4.56..18.28 rows=1 width=8)
               ->  Nested Loop  (cost=4.56..18.28 rows=1 width=8)
                     ->  Index Scan using pg_class_relname_nsp_index on pg_class c  (cost=0.28..8.30 rows=1 width=8)
                           Index Cond: (relname = 'user_subscriptions'::name)
                           Filter: (relkind = ANY ('{r,m,p}'::"char"[]))
                     ->  Bitmap Heap Scan on pg_index x  (cost=4.29..9.96 rows=2 width=8)
                           Recheck Cond: (indrelid = c.oid)
                           ->  Bitmap Index Scan on pg_index_indrelid_index  (cost=0.00..4.29 rows=2 width=0)
                                 Index Cond: (indrelid = c.oid)

With the uncommented OFFSET 0 there is no errors.

from pgcompacttable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.