-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Data model not showing PostgreSQL tables when they are partitioned #15049
Comments
Hi @yasikovsky |
hi @flamber, thanks for your reply! There's no errors in the logs with debug logging enabled - aside of a few warnings: I've tried a few different versions now (thanks to Docker), trying to sync schema every time after switching versions and here are the results:
So it seems this bug was introduced in 0.38.0. All running fine on 0.37.9. |
@yasikovsky Can you include the full sync log? It doesn't say anything about the |
same for us, was working in 1.37.7 and 0.37.8 but not in 1.38.1 |
Same for us. We've had to downgrade to 1.37.x |
@jpbrookes , @bjeanes , can you capture the |
This is on Postgres 11.8 CREATE TABLE public.ahoy_events (
id bigint NOT NULL,
visit_id bigint,
user_id bigint,
name character varying,
properties jsonb,
"time" timestamp without time zone
)
PARTITION BY RANGE ("time");
CREATE SEQUENCE public.ahoy_events_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.ahoy_events_id_seq OWNED BY public.ahoy_events.id;
ALTER TABLE ONLY public.ahoy_events ALTER COLUMN id SET DEFAULT nextval('public.ahoy_events_id_seq'::regclass);
CREATE TABLE public.ahoy_events_20201001 (
id bigint DEFAULT nextval('public.ahoy_events_id_seq'::regclass) NOT NULL,
visit_id bigint,
user_id bigint,
name character varying,
properties jsonb,
"time" timestamp without time zone
);
ALTER TABLE ONLY public.ahoy_events ATTACH PARTITION public.ahoy_events_20201001 FOR VALUES FROM ('2020-10-01 00:00:00') TO ('2020-10-02 00:00:00');
CREATE TABLE public.ahoy_events_20201002 (
id bigint DEFAULT nextval('public.ahoy_events_id_seq'::regclass) NOT NULL,
visit_id bigint,
user_id bigint,
name character varying,
properties jsonb,
"time" timestamp without time zone
);
ALTER TABLE ONLY public.ahoy_events ATTACH PARTITION public.ahoy_events_20201002 FOR VALUES FROM ('2020-10-02 00:00:00') TO ('2020-10-03 00:00:00');
-- etc |
I'm unclear on what change in 0.38 caused this to not work, but I have a fix for it and we will backport to 0.38 in the next bugfix release. |
Awesome. I take it that means my SQL was enough for you to reproduce then. Thank you! |
@bjeanes , indeed, thanks. Should be fixed in the next 0.38 bugfix release. |
tldr about what broke: version bump of postgres driver from 42.2.8 -> 42.2.18. In 42.2.11 they added the ability for the driver to distinguish between tables and partitioned tables. As seen in the fix we now ask for "PARTITIONED TABLE" in addition to "TABLE" and others. |
Dang, nice detective work. |
Describe the bug
If a table is partitioned, it's not being visible in the Data Model section of the admin panel and can't be subsequently accessed when creating a question using the "simple question" method.
Example: I've got a table called "order" partitioned by year with a default partition that stores all the data not fitting the partition. In the earlier versions I could just select the "order" table, in the current I only see the partitions (as per screenshot below):
Logs
No errors in console.
To Reproduce
Create a partitioned PostgreSQL table and try accessing it via Admin -> Data Model.
Expected behavior
You should be able to see and select the whole table, not just its partitions.
Screenshots
Data Model (no Order table):
Simple question (no Order table):
Actual table structure in DataGrip (Order table exists):
Information about your Metabase Installation:
Severity
Blocking some users - the tables can still be accessed using an SQL query, but people not familiar with SQL aren't able to use Metabase.
Additional context
Did work properly in a previous version about two months ago (last time I've checked).
The text was updated successfully, but these errors were encountered: