Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
reshke opened this issue Nov 1, 2024 · 2 comments
Open
2 tasks done

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

reshke opened this issue Nov 1, 2024 · 2 comments
Labels
type: Bug Something isn't working

Comments

@reshke
Copy link
Contributor

reshke commented Nov 1, 2024

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

@reshke reshke added the type: Bug Something isn't working label Nov 1, 2024
@reshke
Copy link
Contributor Author

reshke commented Nov 1, 2024

In fact, we can avoid this by not querying this for partition root. But what info we should provide for \d+ in this case?

@gfphoenix78
Copy link
Contributor

nice catch. I'll fix it in #695

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants