cloudberry
cloudberry copied to clipboard
[Bug] \d+ for cloudberry partitioned table segfault.
Cloudberry Database version
HEAD
What happened
There is an issue with psql \d+ feature for partiotion root tables that i encountered while reviewing pr https://github.com/cloudberrydb/cloudberrydb/pull/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?
- [X] Yes, I am willing to submit a PR!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct.
In fact, we can avoid this by not querying this for partition root. But what info we should provide for \d+ in this case?
nice catch. I'll fix it in https://github.com/cloudberrydb/cloudberrydb/pull/695
Has fixed in #695 . I'll close this issue.