BowlingX/ra-postgraphile

Value "ID_ASC" does not exist in enum (on alternate primary key name column)

drewwestphal opened this issue · 2 comments

Consider a super simple table with a text primary key, e.g.

CREATE TABLE IF NOT EXISTS p2.venue ( venue_name text COLLATE pg_catalog."default" NOT NULL, venue_operator text COLLATE pg_catalog."default" NOT NULL, CONSTRAINT venue_pkey PRIMARY KEY (venue_name) )

Upon trying to view this table with a ListGuesser component, at least, I get the following error:

Variable "$orderBy" got invalid value "ID_ASC" at "orderBy[0]"; Value "ID_ASC" does not exist in "VenuesOrderBy" enum.

Hey :) that's interesting, I did not try the guesser components, but I assume they require a single id field?. I will look into that.

I can update on this. This error also occurs with the standard component if the sort prop is not filled out. I think it just expects a column named id no matter what.

The solution, for now, is to set the sort prop on List to a column that does exist.

E.g. (expanding on the above) <List> becomes <List sort={field: "venueId", order: "ASC"}>