Skip to content

[Bug] \d+ for cloudberry partitioned table segfault. #697

@reshke

Description

@reshke

Cloudberry Database version

HEAD

What happened

There is an issue with psql \d+ feature for partiotion root tables that i encountered while reviewing pr #695.
Long story short:

db2=# \d+ star.trd_fct
row number 0 is out of range 0..-1
row number 0 is out of range 0..-1
cannot duplicate null pointer (internal error)

This is because psql query for partition root returns zero tuples
https://github.com/cloudberrydb/cloudberrydb/blob/main/src/bin/psql/describe.c#L2297

db2=# SELECT a.compresstype, a.compresslevel, a.blocksize, a.checksum FROM pg_catalog.pg_appendonly a, pg_catalog.pg_class c WHERE c.oid = a.relid AND c.oid ='star.trd_fct'::regclass::oid;
 compresstype | compresslevel | blocksize | checksum
--------------+---------------+-----------+----------
(0 rows)

What you think should happen instead

No response

How to reproduce

CREATE TABLE star.trd_fct (
trd_date_key date NOT NULL ,
prod_key integer NOT NULL ,
cust_key integer NOT NULL ,
notional_val numeric(20,10) ,
num_of_shares integer ,
num_of_trades integer ,
trd_id bigint NOT NULL ,
ins_ts timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL
)

WITH (
appendoptimized=true
,orientation=row
,compresstype=zlib
,compresslevel=5
)
DISTRIBUTED RANDOMLY
PARTITION BY RANGE (trd_date_key) (
START ('2020-01-01'::date) INCLUSIVE
END ('2027-01-01'::date) EXCLUSIVE
EVERY (interval '1 Year')
)
;

\d+ star.trd_fct

Operating System

any

Anything else

No response

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: BugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions